search for: have_recvmmsg

Displaying 5 results from an estimated 5 matches for "have_recvmmsg".

2015 Dec 02
5
[PATCH] Receive multiple packets at a time
...trdup strerror strsignal strtol system time usleep unsetenv vsyslog writev], [], [], [#include "src/have.h"] ) --- src/net_packet.c.original 2015-10-02 16:26:36.828841493 +0200 +++ src/net_packet.c 2015-10-02 17:15:05.892051503 +0200 @@ -1057,92 +1057,137 @@ return n; } +#ifdef HAVE_RECVMMSG +#define MAX_MSG 256 +#else +#define MAX_MSG 1 +#endif + void handle_incoming_vpn_data(void *data, int flags) { listen_socket_t *ls = data; - vpn_packet_t pkt; + vpn_packet_t pkt[MAX_MSG]; char *hostname; node_id_t nullid = {}; - sockaddr_t addr = {}; - socklen_t addrlen = sizeof addr; + s...
2015 Dec 10
2
[PATCH] Receive multiple packets at a time
.../src/net_packet.c b/src/net_packet.c index e67857c..174db34 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -695,31 +695,26 @@ static node_t *try_harder(const sockaddr_t *from, const vpn_packet_t *pkt) { return n; } -void handle_incoming_vpn_data(int sock) { - vpn_packet_t pkt; +#ifdef HAVE_RECVMMSG +#define MAX_MSG 256 +#else +#define MAX_MSG 1 +#endif + +static void handle_incoming_vpn_packet(int sock, vpn_packet_t *pkt, sockaddr_t *from) { char *hostname; - sockaddr_t from; - socklen_t fromlen = sizeof(from); node_t *n; - pkt.len = recvfrom(listen_socket[sock].udp, (char *) &pkt...
2015 Dec 02
0
[PATCH] Receive multiple packets at a time
...nv vsyslog writev], > [], [], [#include "src/have.h"] > ) > > --- src/net_packet.c.original 2015-10-02 16:26:36.828841493 +0200 > +++ src/net_packet.c 2015-10-02 17:15:05.892051503 +0200 > @@ -1057,92 +1057,137 @@ > return n; > } > > +#ifdef HAVE_RECVMMSG > +#define MAX_MSG 256 > +#else > +#define MAX_MSG 1 > +#endif > + > void handle_incoming_vpn_data(void *data, int flags) { > listen_socket_t *ls = data; > - vpn_packet_t pkt; > + vpn_packet_t pkt[MAX_MSG]; > char *hostname; >...
2015 Dec 10
0
[PATCH] Receive multiple packets at a time
...wrote: [] I suggest reducing ifdeffery in handle_incoming_vpn_data(), especially the error checking code. The function isn't that large now, it might be much better to have two different implementations. Like this (untested, patch attached): void handle_incoming_vpn_data(int sock) { #ifdef HAVE_RECVMMSG #define MAX_MSG 256 vpn_packet_t pkt[MAX_MSG]; sockaddr_t from[MAX_MSG]; struct mmsghdr msg[MAX_MSG]; struct iovec iov[MAX_MSG]; int num = 1, i; for(i = 0; i < MAX_MSG; i++) { msg[i].msg_hdr.msg_name = &from[i].sa;...
2015 Dec 10
3
[PATCH] Receive multiple packets at a time
...in handle_incoming_vpn_data(), especially > the error checking code. > > The function isn't that large now, it might be much better to have > two different implementations. Like this (untested, patch attached): > > void handle_incoming_vpn_data(int sock) { > > #ifdef HAVE_RECVMMSG > #define MAX_MSG 256 > > vpn_packet_t pkt[MAX_MSG]; > sockaddr_t from[MAX_MSG]; > struct mmsghdr msg[MAX_MSG]; > struct iovec iov[MAX_MSG]; > int num = 1, i; > > for(i = 0; i < MAX_MSG; i++) > { >...