[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[JDEV] ECONNRESET check



Hey there Jabber-folks ...
 
I have had a problem with my transport server crashing when a client is killed without cleanly disconnecting from the socket first ... i.e. I control-c the rug out from underneath the carpet of my client app, so it doesn't get to send its logout message & do a socket close.  The read() call in io.c fails and h_err() kills my transport.
 
A small little fix takes care of this for me ... so I thought I'd mail it in & see if it helped out anyone else as well.
 
io.c:
diff io.c io.c.new
1a2
> #include <errno.h>
83c84,85
<                                               h_err(nbytes,"read");
---
>                                               if(errno != ECONNRESET)
>                                                       h_err(nbytes,"read");
 
This way if the connection was killed, then read() failing & returning -1 lets us "drop the connection" (and the user session) cleanly on our side.
 
---------------------------------------------------------------------------------------------------------
Scott Perrine                                         ph: 415.777.9641
Xuma Technologies LLC                       http://www.xuma.com
World Class Engineering For E-Business
---------------------------------------------------------------------------------------------------------
BEGIN:VCARD
VERSION:2.1
N:Perrine;Scott
FN:Scott Perrine
ORG:Xuma Technologies
TEL;WORK;VOICE:415.777.9641
TEL;WORK;FAX:415.777.2704
ADR;WORK:;;655 Fourth St;San Francisco;CA;94107
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:655 Fourth St=0D=0ASan Francisco, CA 94107
URL:
URL:http://www.xuma.com
EMAIL;PREF;INTERNET:sperrine@xuma.com
REV:19990302T192730Z
END:VCARD