--- gvpe/src/vpn.C 2003/04/08 03:25:35 1.10 +++ gvpe/src/vpn.C 2003/04/13 00:35:46 1.11 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,8 @@ if (ipv4_fd < 0) return -1; + fcntl (ipv4_fd, F_SETFL, O_NONBLOCK); + #ifdef IP_MTU_DISCOVER // this I really consider a linux bug. I am neither connected // nor do I fragment myself. Linux still sets DF and doesn't @@ -113,6 +116,8 @@ if (udpv4_fd < 0) return -1; + fcntl (udpv4_fd, F_SETFL, O_NONBLOCK); + // standard daemon practise... { int oval = 1; @@ -150,6 +155,8 @@ if (icmpv4_fd < 0) return -1; + fcntl (icmpv4_fd, F_SETFL, O_NONBLOCK); + #ifdef ICMP_FILTER { icmp_filter oval; @@ -193,6 +200,8 @@ if (tcpv4_fd < 0) return -1; + fcntl (tcpv4_fd, F_SETFL, O_NONBLOCK); + // standard daemon practise... { int oval = 1; @@ -633,9 +642,11 @@ connection *c = *i; if (c->conf->routerprio > prio - && c->connectmode == conf_node::C_ALWAYS - && c->conf != THISNODE - && c->ictx && c->octx) + && c->connectmode == conf_node::C_ALWAYS // so we don't drop the connection if in use + && c->ictx && c->octx + && c->conf != THISNODE // redundant, since ictx==octx==0 always on thisnode + && (!THISNODE->routerprio + || c->conf->routerprio <= THISNODE->routerprio)) { prio = c->conf->routerprio; router = c;