mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-05 10:58:14 +00:00
There's quite some inconsistency in the internal API. listener_accept() which is the main accept() function returns void but is declared as int in the include file. It's assigned to proto->accept() for all stream protocols where an int is expected but the result is never checked (nor is it documented by the way). This proto->accept() is in turn assigned to fd->iocb() which is supposed to return an int composed of FD_WAIT_* flags, but which is never checked either. So let's fix all this mess : - nobody checks accept()'s return - nobody checks iocb()'s return - nobody sets a return value => let's mark all these functions void and keep the current ones intact. Additionally we now include listener.h from listener.c to ensure we won't silently hide this incoherency in the future. Note that this patch could/should be backported to 1.6 and even 1.5 to simplify debugging sessions.
34 lines
723 B
C
34 lines
723 B
C
/*
|
|
* UDP protocol related functions
|
|
*
|
|
* Copyright 2014 Baptiste Assmann <bedis9@gmail.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*
|
|
*/
|
|
|
|
#include <types/global.h>
|
|
#include <types/fd.h>
|
|
#include <types/proto_udp.h>
|
|
|
|
#include <proto/fd.h>
|
|
|
|
/* datagram handler callback */
|
|
void dgram_fd_handler(int fd)
|
|
{
|
|
struct dgram_conn *dgram = fdtab[fd].owner;
|
|
|
|
if (unlikely(!dgram))
|
|
return;
|
|
|
|
if (fd_recv_ready(fd))
|
|
dgram->data->recv(dgram);
|
|
else if (fd_send_ready(fd))
|
|
dgram->data->send(dgram);
|
|
|
|
return;
|
|
}
|