2015-04-13 21:08:16 +00:00
|
|
|
/*
|
2020-06-11 07:23:02 +00:00
|
|
|
* Datagram processing functions
|
2015-04-13 21:08:16 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-06-03 17:33:00 +00:00
|
|
|
#include <haproxy/fd.h>
|
2020-06-11 07:23:02 +00:00
|
|
|
#include <haproxy/dgram.h>
|
2015-04-13 21:08:16 +00:00
|
|
|
|
|
|
|
/* datagram handler callback */
|
2016-04-14 09:13:20 +00:00
|
|
|
void dgram_fd_handler(int fd)
|
2015-04-13 21:08:16 +00:00
|
|
|
{
|
|
|
|
struct dgram_conn *dgram = fdtab[fd].owner;
|
|
|
|
|
|
|
|
if (unlikely(!dgram))
|
2016-04-14 09:13:20 +00:00
|
|
|
return;
|
2015-04-13 21:08:16 +00:00
|
|
|
|
|
|
|
if (fd_recv_ready(fd))
|
|
|
|
dgram->data->recv(dgram);
|
2019-12-10 17:12:04 +00:00
|
|
|
if (fd_send_ready(fd))
|
2015-04-13 21:08:16 +00:00
|
|
|
dgram->data->send(dgram);
|
|
|
|
|
2016-04-14 09:13:20 +00:00
|
|
|
return;
|
2015-04-13 21:08:16 +00:00
|
|
|
}
|