int init_connection();
/* I/O callback for fd-based connections. It calls the read/write handlers
- * provided by the connection's sock_ops. Returns 0.
+ * provided by the connection's sock_ops.
*/
-int conn_fd_handler(int fd);
+void conn_fd_handler(int fd);
/* receive a PROXY protocol header over a connection */
int conn_recv_proxy(struct connection *conn, int flag);
* to an accept. It tries to accept as many connections as possible, and for each
* calls the listener's accept handler (generally the frontend's accept handler).
*/
-int listener_accept(int fd);
+void listener_accept(int fd);
/*
* Registers the bind keyword list <kwl> as a list of valid keywords for next
#ifndef _PROTO_PROTO_UDP_H
#define _PROTO_PROTO_UDP_H
-int dgram_fd_handler(int);
+void dgram_fd_handler(int);
#endif // _PROTO_PROTO_UDP_H
/* info about one given fd */
struct fdtab {
- int (*iocb)(int fd); /* I/O handler, returns FD_WAIT_* */
+ void (*iocb)(int fd); /* I/O handler */
void *owner; /* the connection or listener associated with this fd, NULL if closed */
unsigned int cache; /* position+1 in the FD cache. 0=not in cache. */
unsigned char state; /* FD state for read and write directions (2*3 bits) */
sa_family_t sock_family; /* socket family, for sockaddr */
socklen_t sock_addrlen; /* socket address length, used by bind() */
int l3_addrlen; /* layer3 address length, used by hashes */
- int (*accept)(int fd); /* generic accept function */
+ void (*accept)(int fd); /* generic accept function */
int (*bind)(struct listener *l, char *errmsg, int errlen); /* bind a listener */
int (*bind_all)(struct protocol *proto, char *errmsg, int errlen); /* bind all unbound listeners */
int (*unbind_all)(struct protocol *proto); /* unbind all bound listeners */
}
/* I/O callback for fd-based connections. It calls the read/write handlers
- * provided by the connection's sock_ops, which must be valid. It returns 0.
+ * provided by the connection's sock_ops, which must be valid.
*/
-int conn_fd_handler(int fd)
+void conn_fd_handler(int fd)
{
struct connection *conn = fdtab[fd].owner;
unsigned int flags;
if (unlikely(!conn))
- return 0;
+ return;
conn_refresh_polling_flags(conn);
flags = conn->flags & ~CO_FL_ERROR; /* ensure to call the wake handler upon error */
* we must not use it anymore and should immediately leave instead.
*/
if ((conn->flags & CO_FL_INIT_DATA) && conn->data->init(conn) < 0)
- return 0;
+ return;
/* The data transfer starts here and stops on error and handshakes. Note
* that we must absolutely test conn->xprt at each step in case it suddenly
if ((conn->flags & CO_FL_WAKE_DATA) &&
((conn->flags ^ flags) & CO_FL_CONN_STATE) &&
conn->data->wake(conn) < 0)
- return 0;
+ return;
/* Last check, verify if the connection just established */
if (unlikely(!(conn->flags & (CO_FL_WAIT_L4_CONN | CO_FL_WAIT_L6_CONN | CO_FL_CONNECTED))))
/* commit polling changes */
conn_cond_update_polling(conn);
- return 0;
+ return;
}
/* Update polling on connection <c>'s file descriptor depending on its current
#include <proto/fd.h>
#include <proto/freq_ctr.h>
#include <proto/log.h>
+#include <proto/listener.h>
#include <proto/sample.h>
#include <proto/stream.h>
#include <proto/task.h>
#include <proto/fd.h>
/* datagram handler callback */
-int dgram_fd_handler(int fd)
+void dgram_fd_handler(int fd)
{
struct dgram_conn *dgram = fdtab[fd].owner;
if (unlikely(!dgram))
- return 0;
+ return;
if (fd_recv_ready(fd))
dgram->data->recv(dgram);
else if (fd_send_ready(fd))
dgram->data->send(dgram);
- return 0;
+ return;
}