diff --git a/libtransmission/net.c b/libtransmission/net.c index 567de25e1..8161a2a65 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.c @@ -347,8 +347,11 @@ struct tr_peer_socket tr_netOpenPeerSocket(tr_session* session, tr_address const ret = tr_peer_socket_tcp_create(s); } - tr_logAddDeep(__FILE__, __LINE__, NULL, "New OUTGOING connection %" PRIdMAX " (%s)", (intmax_t)s, - tr_peerIoAddrStr(addr, port)); + if (tr_logGetDeepEnabled()) + { + tr_logAddDeep(__FILE__, __LINE__, NULL, "New OUTGOING connection %" PRIdMAX " (%s)", (intmax_t)s, + tr_peerIoAddrStr(addr, port)); + } return ret; } diff --git a/libtransmission/session.c b/libtransmission/session.c index faeda5dd0..48a090498 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -173,8 +173,12 @@ static void accept_incoming_peer(evutil_socket_t fd, short what UNUSED, void* vs if (clientSocket != TR_BAD_SOCKET) { - tr_logAddDeep(__FILE__, __LINE__, NULL, "new incoming connection %" PRIdMAX " (%s)", (intmax_t)clientSocket, - tr_peerIoAddrStr(&clientAddr, clientPort)); + if (tr_logGetDeepEnabled()) + { + tr_logAddDeep(__FILE__, __LINE__, NULL, "new incoming connection %" PRIdMAX " (%s)", (intmax_t)clientSocket, + tr_peerIoAddrStr(&clientAddr, clientPort)); + } + tr_peerMgrAddIncoming(session->peerMgr, &clientAddr, clientPort, tr_peer_socket_tcp_create(clientSocket)); } } diff --git a/libtransmission/stats.c b/libtransmission/stats.c index 0113860c9..1e11ab17a 100644 --- a/libtransmission/stats.c +++ b/libtransmission/stats.c @@ -110,7 +110,11 @@ static void saveCumulativeStats(tr_session const* session, tr_session_stats cons tr_variantDictAddInt(&top, TR_KEY_uploaded_bytes, s->uploadedBytes); filename = getFilename(session); - tr_logAddDeep(__FILE__, __LINE__, NULL, "Saving stats to \"%s\"", filename); + if (tr_logGetDeepEnabled()) + { + tr_logAddDeep(__FILE__, __LINE__, NULL, "Saving stats to \"%s\"", filename); + } + tr_variantToFile(&top, TR_VARIANT_FMT_JSON, filename); tr_free(filename); diff --git a/libtransmission/trevent.c b/libtransmission/trevent.c index efbc1479e..3c69c2481 100644 --- a/libtransmission/trevent.c +++ b/libtransmission/trevent.c @@ -305,7 +305,11 @@ void tr_eventClose(tr_session* session) } session->events->die = true; - tr_logAddDeep(__FILE__, __LINE__, NULL, "closing trevent pipe"); + if (tr_logGetDeepEnabled()) + { + tr_logAddDeep(__FILE__, __LINE__, NULL, "closing trevent pipe"); + } + tr_netCloseSocket(session->events->fds[1]); }