Date: Thu, 16 May 96 11:02:50 BST From: kbracey@art.acorn.co.uk (Kevin Bracey) To: freebsd-hackers@freebsd.org Subject: Problem with non-blocking TCP connects? Message-ID: <319B0B5A@kbracey>
next in thread | raw e-mail | index | archive | help
There is an interesting anomaly in the processing of non-blocking TCP connections. In the case of a loop like while (!connected) { if (connect(s, addr, addrlen) < 0) { if (errno == EINPROGRESS || errno == EALREADY) continue; else if (errno == EISCONN) connected = 1; else return errno; } else connected = 1; } you would normally expect a sequence of errors from connect like: EINPROGRESS EALREADY EALREADY EALREADY EISCONN or, if the connection is refused EINPROGRESS EALREADY EALREADY ECONNREFUSED The former happens, but in the latter case you get EINVAL instead of ECONNREFUSED. This is because when the connection is refused, TCP discards its PCBs and refuses to have anything to do with the relevant socket. Should there be some sort of patch to tcp_usrreq() to check so->so_error (which in the above case is actually set to ECONNREFUSED) and return that if set, before complaining about the lack of a PCB? Kevin Bracey Acorn RISC Technologies
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?319B0B5A>