Fix: poll: show the correct number of fds
[lttng-tools.git] / src / bin / lttng-sessiond / jul-thread.c
index 9c924ea40ebfe5c4f721ff099b0b327b149500aa..4a6fc2a849ed2f777daebd85fe56ba87a2d845cb 100644 (file)
@@ -34,7 +34,8 @@
  * can let the user define a custom one. However, localhost is ALWAYS the
  * default listening address.
  */
-static const char *default_reg_uri = "tcp://localhost";
+static const char *default_reg_uri =
+       "tcp://" DEFAULT_NETWORK_VIEWER_BIND_ADDRESS;
 
 /*
  * Update JUL application using the given socket. This is done just after
@@ -205,7 +206,7 @@ static int handle_registration(struct lttcomm_sock *reg_sock,
 
        size = new_sock->ops->recvmsg(new_sock, &msg, sizeof(msg), 0);
        if (size < sizeof(msg)) {
-               ret = -errno;
+               ret = -EINVAL;
                goto error_socket;
        }
        pid = be32toh(msg.pid);
@@ -281,12 +282,13 @@ void *jul_thread_manage_registration(void *data)
        }
 
        while (1) {
-               DBG3("[jul-thread] Manage JUL polling on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+               DBG3("[jul-thread] Manage JUL polling");
 
                /* Inifinite blocking call, waiting for transmission */
 restart:
                ret = lttng_poll_wait(&events, -1);
+               DBG3("[jul-thread] Manage agent return from poll on %d fds",
+                               LTTNG_POLL_GETNB(&events));
                if (ret < 0) {
                        /*
                         * Restart interrupted system call.
@@ -304,6 +306,11 @@ restart:
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
This page took 0.024833 seconds and 4 git commands to generate.