mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
Include strerror output in a few socket-related error messages.
This commit is contained in:
parent
8284799abe
commit
9ab746d8ac
1 changed files with 5 additions and 3 deletions
|
@ -502,7 +502,7 @@ linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize )
|
||||||
unsigned short packetSize;
|
unsigned short packetSize;
|
||||||
ssize_t nRead = recv( sock, &tmp, sizeof(tmp), 0 );
|
ssize_t nRead = recv( sock, &tmp, sizeof(tmp), 0 );
|
||||||
if ( nRead != 2 ) {
|
if ( nRead != 2 ) {
|
||||||
XP_LOGF( "recv => %d, errno=%d", nRead, errno );
|
XP_LOGF( "recv => %d, errno=%d (\"%s\")", nRead, errno, strerror(errno) );
|
||||||
linux_close_socket( cGlobals );
|
linux_close_socket( cGlobals );
|
||||||
comms_transportFailed( cGlobals->game.comms );
|
comms_transportFailed( cGlobals->game.comms );
|
||||||
nRead = -1;
|
nRead = -1;
|
||||||
|
@ -512,7 +512,8 @@ linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize )
|
||||||
assert( packetSize <= bufSize );
|
assert( packetSize <= bufSize );
|
||||||
nRead = recv( sock, buf, packetSize, 0 );
|
nRead = recv( sock, buf, packetSize, 0 );
|
||||||
if ( nRead < 0 ) {
|
if ( nRead < 0 ) {
|
||||||
XP_WARNF( "linuxReceive: errno=%d\n", errno );
|
XP_WARNF( "linuxReceive: errno=%d (\"%s\")\n", errno,
|
||||||
|
strerror(errno) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nRead;
|
return nRead;
|
||||||
|
@ -558,7 +559,8 @@ linux_util_makeStreamFromAddr( XW_UtilCtxt* uctx, XP_U16 channelNo )
|
||||||
newSocket );
|
newSocket );
|
||||||
/* #define EADDRINUSE 98 */
|
/* #define EADDRINUSE 98 */
|
||||||
result = bind( newSocket, (struct sockaddr*)returnAddr, addrLen );
|
result = bind( newSocket, (struct sockaddr*)returnAddr, addrLen );
|
||||||
fprintf( stderr, "bind returned %d; errno=%d\n", result, errno );
|
fprintf( stderr, "bind returned %d; errno=%d (\"%s\")\n", result, errno,
|
||||||
|
strerror(errno) );
|
||||||
|
|
||||||
return linux_make_socketStream( newSocket );
|
return linux_make_socketStream( newSocket );
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue