Displaying 6 results from an estimated 6 matches for "max_msg".
2015 Dec 10
2
[PATCH] Receive multiple packets at a time
.../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.seqno, MAXSIZE,...
2015 Dec 10
3
[PATCH] Receive multiple packets at a time
...(), 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_...
2015 Dec 02
5
[PATCH] Receive multiple packets at a time
...l 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;
+ sockaddr_t addr[MA...
2015 Dec 10
0
[PATCH] Receive multiple packets at a time
...educing 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;
ms...
2015 Dec 02
0
[PATCH] Receive multiple packets at a time
...[], [], [#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 = {};...
2011 Jun 02
2
Custom sql query for keeping quota with dict-sql
Hello!
I'd like to setup quota for for virtualusers, i'm using both maildir++
and mdbox as storage, and i'm using postgresql to keep users.
I'm keeping all users data in one table:
[...]
login text NOT NULL,
domain text,
password text,
quota_mb integer NOT NULL DEFAULT 0
[... other columns ...]
i'd like to keep present quota in such two columns:
quota_dict_bytes integer NOT