lib/libvarnish/vtcp.c
int
VTCP_connected(int s)
{
	int k;
	socklen_t l;

	/* Find out if we got a connection */
	l = sizeof k;
	AZ(getsockopt(s, SOL_SOCKET, SO_ERROR, &k, &l));

	/* An error means no connection established */
	errno = k;
	if (k) {
		closefd(&s);
		return (-1);
	}

	VTCP_blocking(s);
	return (s);
}
/*--------------------------------------------------------------------
 * On TCP a connect(2) can block for a looong time, and we don't want that.
 * Unfortunately, the SocketWizards back in those days were happy to wait
 * any amount of time for a connection, so the connect(2) syscall does not
 * take an argument for patience.
 *
 * There is a little used work-around, and we employ it at our peril.
 *
 */
On TCP a connect(2) can block for a looong time, and we don't want that.
Unfortunately, the SocketWizards back in those days were happy to wait
any amount of time for a connection, so the connect(2) syscall does not
take an argument for patience.

There is a little used work-around, and we employ it at our peril.
On TCP a connect ( 2 ) can block for a looong time and we don ' t want that . Unfortunately the SocketWizards back in those days were happy to wait any amount of time for a connection so the connect ( 2 ) syscall does not take an argument for patience . There is a little used work - around and we employ it at our peril .
int
VTCP_connected(int s)
{
	int k;
	socklen_t l;
	l = sizeof k;
	AZ(getsockopt(s, SOL_SOCKET, SO_ERROR, &k, &l));
	errno = k;
	if (k) {
		closefd(&s);
		return (-1);
	}
	VTCP_blocking(s);
	return (s);
}
int VTCP_connected ( int s ) { int k ; socklen_t l ; l = sizeof k ; AZ ( getsockopt ( s , SOL_SOCKET , SO_ERROR , & k , & l ) ) ; errno = k ; if ( k ) { closefd ( & s ) ; return ( -1 ) ; } VTCP_blocking ( s ) ; return ( s ) ; }
On TCP a connect(2) can block for a looong time, and we don't want that.
On TCP a connect ( 2 ) can block for a looong time and we don ' t want that .
/* Find out if we got a connection */ /* An error means no connection established */