In C with this code, I am getting a SIGPIPE with send
:
if ( ( nWrite = send( d->descriptor, txt + iStart, nBlock, 0 ) ) < 0 )
The full backtrace:
Program received signal SIGPIPE, Broken pipe.
0xb7fe37f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#0 0xb7fe37f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0xb7d654a1 in send () from /lib/libc.so.6
#2 0x08085646 in write_to_descriptor (d=0x97a6028, txt=0x8316b28 "Idle timeout... disconnecting.\n\r", length=32) at comm.c:1750
#3 0x080828a8 in game_loop () at comm.c:823
#4 0x08081b49 in main (argc=2, argv=0xbffffb54) at comm.c:425
(gdb) f 2
#2 0x08085646 in write_to_descriptor (d=0x97a6028, txt=0x8316b28 "Idle timeout... disconnecting.\n\r", length=32) at comm.c:1750
1750 if ( ( nWrite = send( d->descriptor, txt + iStart, nBlock, 0 ) ) < 0 )
Variable info:
(gdb) p nWrite
$4 = 0
(gdb) p d->descriptor
$5 = 14
(gdb) p txt
$6 = 0x8316b28 "Idle timeout... disconnecting.\n\r"
(gdb) p iStart
$7 = 0
(gdb) p nBlock
$8 = 32
Is there a specific ifcheck I should be doing to account for a closed socket here?
I have this already in the game loop:
signal( SIGPIPE, SIG_IGN );
signal( SIGALRM, caught_alarm );