Revert sosend() to its behavior from 4.3-Tahoe and before: if

so_error is set, clear it before returning it.  The behavior
introduced in 4.3-Reno (to not clear so_error) causes potentially
transient errors (e.g.  ECONNREFUSED if the other end hasn't opened
its socket yet) to be permanent on connected datagram sockets that
are only used for writing.

(soreceive() clears so_error before returning it, as does
getsockopt(...,SO_ERROR,...).)

Submitted by:	Van Jacobson <van@ee.lbl.gov>, via a comment in the vat sources.
This commit is contained in:
Bill Fenner 1998-02-19 19:38:20 +00:00
parent a00fe97d5a
commit 92f57d003c

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
* $Id: uipc_socket.c,v 1.35 1998/02/04 22:32:37 eivind Exp $
* $Id: uipc_socket.c,v 1.36 1998/02/06 12:13:28 eivind Exp $
*/
#include <sys/param.h>
@ -384,8 +384,12 @@ restart:
s = splnet();
if (so->so_state & SS_CANTSENDMORE)
snderr(EPIPE);
if (so->so_error)
snderr(so->so_error);
if (so->so_error) {
error = so->so_error;
so->so_error = 0;
splx(s);
goto release;
}
if ((so->so_state & SS_ISCONNECTED) == 0) {
/*
* `sendto' and `sendmsg' is allowed on a connection-