----- Original Message -----
From: "Steven Hartland" <[email protected]>
...
Now given no previous errors from either connect, send or recv
if the connection has been terminated by the other end, which
tcpdump shows its has (RST), I would expect to get ECONNRESET
from getpeername and not ENOTCONN.
The only case I would expect ENOTCONN is if either no connect
call had been made or if it was unsuccessful.
Am I missing something here, is ENOTCONN and expected result
from a previously connected socket with no other indication
of error?
After doing some more digging the issue may be in
sys/kern/uipc_syscalls.c: kern_getpeername where it checks against
so_state for SS_ISCONNECTED which can of course be true if the
socket was never connected as well as if the socket has been reset
by the peer.
Should the following code:
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) {
error = ENOTCONN;
goto done;
}
become something like:
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) {
if ((so->so_state & SS_ISDISCONNECTED) == 0) {
error = ECONNRESET;
} else {
error = ENOTCONN;
}
goto done;
}
This would obviously report ECONNRESET for shutdown sockets as
well as sockets reset by the peer, but I cant see an easy way to
distinguish between these two cases without adding a new state
value specifically for reset.
Regards
Steve
================================================
This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it.
In the event of misdirection, illegible or incomplete transmission please
telephone +44 845 868 1337
or return the E.mail to [email protected].
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[email protected]"