[JDEV] ECONNRESET check

Scott Perrine sperrine at xuma.com
Tue Mar 2 13:27:30 CST 1999


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
---------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/19990302/aeb1ff18/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Scott Perrine.vcf
Type: text/x-vcard
Size: 359 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/19990302/aeb1ff18/attachment-0002.vcf>


More information about the JDev mailing list