X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fsessiond-comm%2Finet.cpp;fp=src%2Fcommon%2Fsessiond-comm%2Finet.cpp;h=15e6ba7c8b8276a2ab9fcb29b2a7d3f9e5e21948;hb=28ab034a2c3582d07d3423d2d746731f87d3969f;hp=30aa8c6134a42903f2df14cd6e0e69c103d2173a;hpb=52e345b9ac912d033c2a2c25a170a01cf209839d;p=lttng-tools.git diff --git a/src/common/sessiond-comm/inet.cpp b/src/common/sessiond-comm/inet.cpp index 30aa8c613..15e6ba7c8 100644 --- a/src/common/sessiond-comm/inet.cpp +++ b/src/common/sessiond-comm/inet.cpp @@ -6,25 +6,25 @@ */ #define _LGPL_SOURCE +#include "inet.hpp" + +#include +#include +#include +#include + #include +#include #include +#include #include #include #include #include #include #include -#include -#include -#include - -#include -#include -#include - -#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);