]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: fd: remove the need for the socket layer to recheck the connection
authorWilly Tarreau <w@1wt.eu>
Fri, 11 May 2012 17:53:32 +0000 (19:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 May 2012 18:18:26 +0000 (20:18 +0200)
commiteeda90e68c19d2184e644a631212983757db3249
treece22811af225c8539baee6e3095da947210f1ecf
parentd02394b5a1468618cf708fb240a8b0930c077663
MAJOR: fd: remove the need for the socket layer to recheck the connection

Up to now, if an outgoing connection had no data to send, the socket layer
had to perform a connect() again to check for establishment. This is not
acceptable for SSL, and will cause problems with socketpair(). Some socket
layers will also need an initializer before sending data (eg: SSL).

The solution consists in moving the connect() test to the protocol layer
(eg: TCP) and to make it hold the fd->write callback until the connection
is validated. At this point, it will switch the write callback to the
socket layer's write function. In fact we need to hold both read and write
callbacks to ensure the socket layer is never called before being initialized.

This intermediate callback is used only if there is a socket init function
or if there are no data to send.

The socket layer does not have any code to check for connection establishment
anymore, which makes sense.
src/proto_tcp.c
src/sock_raw.c