Skip to content

Commit cfa96a9

Browse files
authored
Add logs for socket creation fd (#2124)
* Add log for socket creation fd * Clang-format
1 parent 59404a2 commit cfa96a9

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/source/Ice/IceUtils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ STATUS iceUtilsSendStunPacket(PStunPacket pStunPacket, PBYTE password, UINT32 pa
172172
CHK(pDest != NULL, STATUS_NULL_ARG);
173173
switch (pStunPacket->header.stunMessageType) {
174174
case STUN_PACKET_TYPE_BINDING_REQUEST:
175-
DLOGD("Sending BINDING_REQUEST to ip:%u.%u.%u.%u, port:%u", pDest->address[0], pDest->address[1], pDest->address[2], pDest->address[3],
176-
(UINT16) getInt16(pDest->port));
175+
DLOGD("Sending BINDING_REQUEST on socket id: %d, to ip:%u.%u.%u.%u, port:%u", pSocketConnection->localSocket, pDest->address[0],
176+
pDest->address[1], pDest->address[2], pDest->address[3], (UINT16) getInt16(pDest->port));
177177
break;
178178
case STUN_PACKET_TYPE_BINDING_RESPONSE_SUCCESS:
179-
DLOGD("Sending BINDING_RESPONSE_SUCCESS to ip:%u.%u.%u.%u, port:%u", pDest->address[0], pDest->address[1], pDest->address[2],
180-
pDest->address[3], (UINT16) getInt16(pDest->port));
179+
DLOGD("Sending BINDING_RESPONSE_SUCCESS on socket id: %d to ip:%u.%u.%u.%u, port:%u", pSocketConnection->localSocket, pDest->address[0],
180+
pDest->address[1], pDest->address[2], pDest->address[3], (UINT16) getInt16(pDest->port));
181181
break;
182182
default:
183183
break;

src/source/Ice/IceUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ STATUS iceUtilsSendStunPacket(PStunPacket, PBYTE, UINT32, PKvsIpAddress, PSocket
5151
STATUS iceUtilsSendData(PBYTE, UINT32, PKvsIpAddress, PSocketConnection, struct __TurnConnection*, BOOL);
5252

5353
typedef struct {
54+
// isTurn ? TURN server : STUN server
5455
BOOL isTurn;
5556
BOOL isSecure;
5657
CHAR url[MAX_ICE_CONFIG_URI_LEN + 1];

src/source/Ice/SocketConnection.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ STATUS createSocketConnection(KVS_IP_FAMILY_TYPE familyType, KVS_SOCKET_PROTOCOL
4747

4848
if (pBindAddr) {
4949
getIpAddrStr(pBindAddr, ipAddr, ARRAY_SIZE(ipAddr));
50-
DLOGD("create socket with ip: %s:%u. family:%d", ipAddr, (UINT16) getInt16(pBindAddr->port), pBindAddr->family);
50+
DLOGD("create socket id: %d, with ip: %s:%u. family:%d", pSocketConnection->localSocket, ipAddr, (UINT16) getInt16(pBindAddr->port),
51+
pBindAddr->family);
5152
} else {
52-
DLOGD("create socket without the bind address(%d:%d)", familyType, protocol);
53+
DLOGD("create socket id %d, without the bind address(%d:%d)", pSocketConnection->localSocket, familyType, protocol);
5354
}
5455
if (protocol == KVS_SOCKET_PROTOCOL_TCP) {
5556
getIpAddrStr(pPeerIpAddr, ipAddr, ARRAY_SIZE(ipAddr));
@@ -408,7 +409,7 @@ STATUS socketSendDataWithRetry(PSocketConnection pSocketConnection, PBYTE buf, U
408409
/* nothing need to be done, just retry */
409410
} else {
410411
/* fatal error from send() */
411-
DLOGE("sendto() failed with errno %s(%d)", getErrorString(errorNum), errorNum);
412+
DLOGE("sendto() socket %d failed with errno %s(%d)", pSocketConnection->localSocket, getErrorString(errorNum), errorNum);
412413
CHAR ipAddr[KVS_IP_ADDRESS_STRING_BUFFER_LEN];
413414

414415
if (pDestIp != NULL) {

0 commit comments

Comments
 (0)