Run clang-format on the whole tree
[lttng-tools.git] / src / common / sessiond-comm / inet.cpp
index 30aa8c6134a42903f2df14cd6e0e69c103d2173a..15e6ba7c8b8276a2ab9fcb29b2a7d3f9e5e21948 100644 (file)
@@ -6,25 +6,25 @@
  */
 
 #define _LGPL_SOURCE
+#include "inet.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/compat/time.hpp>
+#include <common/time.hpp>
+
 #include <algorithm>
+#include <fcntl.h>
 #include <limits.h>
+#include <poll.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <common/compat/time.hpp>
-#include <poll.h>
-
-#include <common/common.hpp>
-#include <common/time.hpp>
-#include <common/compat/errno.hpp>
-
-#include "inet.hpp"
 
-#define RECONNECT_DELAY        200     /* ms */
+#define RECONNECT_DELAY 200 /* ms */
 
 /*
  * INET protocol operations.
@@ -93,16 +93,14 @@ int lttcomm_bind_inet_sock(struct lttcomm_sock *sock)
        return bind(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
 }
 
-static
-int connect_no_timeout(struct lttcomm_sock *sock)
+static int connect_no_timeout(struct lttcomm_sock *sock)
 {
        struct sockaddr_in sockaddr = sock->sockaddr.addr.sin;
 
        return connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
 }
 
-static
-int connect_with_timeout(struct lttcomm_sock *sock)
+static int connect_with_timeout(struct lttcomm_sock *sock)
 {
        unsigned long timeout = lttcomm_get_network_timeout();
        int ret, flags, connect_ret;
@@ -132,8 +130,7 @@ int connect_with_timeout(struct lttcomm_sock *sock)
 
        sockaddr = sock->sockaddr.addr.sin;
        connect_ret = connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
-       if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK &&
-                       errno != EINPROGRESS) {
+       if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINPROGRESS) {
                goto error;
        } else if (!connect_ret) {
                /* Connect succeeded */
@@ -141,7 +138,9 @@ int connect_with_timeout(struct lttcomm_sock *sock)
        }
 
        DBG("Asynchronous connect for sock %d, performing polling with"
-                       " timeout: %lums", sock->fd, timeout);
+           " timeout: %lums",
+           sock->fd,
+           timeout);
        /*
         * Perform poll loop following EINPROGRESS recommendation from
         * connect(2) man page.
@@ -165,8 +164,7 @@ int connect_with_timeout(struct lttcomm_sock *sock)
                                goto error;
                        }
                        /* got something */
-                       ret = getsockopt(sock->fd, SOL_SOCKET,
-                               SO_ERROR, &optval, &optval_len);
+                       ret = getsockopt(sock->fd, SOL_SOCKET, SO_ERROR, &optval, &optval_len);
                        if (ret) {
                                PERROR("getsockopt");
                                goto error;
@@ -334,8 +332,7 @@ end:
  *
  * Return the size of received data.
  */
-ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
-               size_t len, int flags)
+ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -390,8 +387,7 @@ end:
  *
  * Return the size of sent data.
  */
-ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf,
-               size_t len, int flags)
+ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -525,8 +521,8 @@ void lttcomm_inet_init(void)
         * Get the maximum between the two possible timeout value and use that to
         * get the maximum with the default timeout.
         */
-       lttcomm_inet_tcp_timeout = std::max(std::max(syn_timeout, fin_timeout),
-                       lttcomm_inet_tcp_timeout);
+       lttcomm_inet_tcp_timeout =
+               std::max(std::max(syn_timeout, fin_timeout), lttcomm_inet_tcp_timeout);
 
 end:
        DBG("TCP inet operation timeout set to %lu sec", lttcomm_inet_tcp_timeout);
This page took 0.027593 seconds and 4 git commands to generate.