mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-10-09 22:51:22 +02:00
Up to now, we had to use a shutr/shutw interface per data layer, which basically means 3 distinct functions when we include SSL : - generic stream_interface - sock_raw - sock_ssl With this change, the code located in the stream_interface manages all the stream_interface and buffer updates, and calls the data layer hooks when needed. At the moment, the socket layer hook had been implicitly considered as being a regular socket, so the si_shut*() functions call the normal shutdown() and EV_FD_CLR() functions on the fd if a socket layer is defined. This may change in the future. The stream_int_shut*() functions don't call EV_FD_CLR() so that they can later be embedded in lower layers. Thus, the si->data->shutr() is not called anymore and si->data->shutw() is called to close the data layer only (eg: only for SSL). Proceeding like this is very important because it's the only way to be able not to rely on these functions when called from the connection handlers, and call the data layers' instead.
49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
/*
|
|
* include/proto/connection.h
|
|
* This file contains connection function prototypes
|
|
*
|
|
* Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
* exclusively.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef _PROTO_CONNECTION_H
|
|
#define _PROTO_CONNECTION_H
|
|
|
|
#include <common/config.h>
|
|
#include <types/connection.h>
|
|
|
|
/* I/O callback for fd-based connections. It calls the read/write handlers
|
|
* provided by the connection's sock_ops. Returns FD_WAIT_*.
|
|
*/
|
|
int conn_fd_handler(int fd);
|
|
|
|
/* Calls the close() function of the data layer if any */
|
|
static inline void conn_data_close(struct connection *conn)
|
|
{
|
|
if (conn->data && conn->data->close)
|
|
conn->data->close(conn);
|
|
}
|
|
|
|
|
|
#endif /* _PROTO_CONNECTION_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|