mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
Check if log deep is enabled before tr_logAddDeep (#1329)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
910944733e
commit
5be8bd50f9
4 changed files with 21 additions and 6 deletions
|
@ -347,8 +347,11 @@ struct tr_peer_socket tr_netOpenPeerSocket(tr_session* session, tr_address const
|
||||||
ret = tr_peer_socket_tcp_create(s);
|
ret = tr_peer_socket_tcp_create(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_logAddDeep(__FILE__, __LINE__, NULL, "New OUTGOING connection %" PRIdMAX " (%s)", (intmax_t)s,
|
if (tr_logGetDeepEnabled())
|
||||||
tr_peerIoAddrStr(addr, port));
|
{
|
||||||
|
tr_logAddDeep(__FILE__, __LINE__, NULL, "New OUTGOING connection %" PRIdMAX " (%s)", (intmax_t)s,
|
||||||
|
tr_peerIoAddrStr(addr, port));
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,12 @@ static void accept_incoming_peer(evutil_socket_t fd, short what UNUSED, void* vs
|
||||||
|
|
||||||
if (clientSocket != TR_BAD_SOCKET)
|
if (clientSocket != TR_BAD_SOCKET)
|
||||||
{
|
{
|
||||||
tr_logAddDeep(__FILE__, __LINE__, NULL, "new incoming connection %" PRIdMAX " (%s)", (intmax_t)clientSocket,
|
if (tr_logGetDeepEnabled())
|
||||||
tr_peerIoAddrStr(&clientAddr, clientPort));
|
{
|
||||||
|
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));
|
tr_peerMgrAddIncoming(session->peerMgr, &clientAddr, clientPort, tr_peer_socket_tcp_create(clientSocket));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,11 @@ static void saveCumulativeStats(tr_session const* session, tr_session_stats cons
|
||||||
tr_variantDictAddInt(&top, TR_KEY_uploaded_bytes, s->uploadedBytes);
|
tr_variantDictAddInt(&top, TR_KEY_uploaded_bytes, s->uploadedBytes);
|
||||||
|
|
||||||
filename = getFilename(session);
|
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_variantToFile(&top, TR_VARIANT_FMT_JSON, filename);
|
||||||
|
|
||||||
tr_free(filename);
|
tr_free(filename);
|
||||||
|
|
|
@ -305,7 +305,11 @@ void tr_eventClose(tr_session* session)
|
||||||
}
|
}
|
||||||
|
|
||||||
session->events->die = true;
|
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]);
|
tr_netCloseSocket(session->events->fds[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue