--- gvpe/src/vpn_tcp.C 2007/12/01 23:35:31 1.20 +++ gvpe/src/vpn_tcp.C 2007/12/02 00:39:06 1.21 @@ -71,6 +71,7 @@ } tcp_si; struct tcp_connection : ev::io { + int tos; tstamp last_activity; const sockinfo si; vpn &v; @@ -411,7 +412,11 @@ // how this maps to the underlying tcp packets we don't know // and we don't care. at least we tried ;) #if defined(SOL_IP) && defined(IP_TOS) - setsockopt (fd, SOL_IP, IP_TOS, &tos, sizeof tos); + if (tos != this->tos) + { + this->tos = tos; + setsockopt (fd, SOL_IP, IP_TOS, &tos, sizeof tos); + } #endif w_pkt = pkt; @@ -440,7 +445,8 @@ if (fd >= 0) { close (fd); - fd = -1; + tos = -1; + fd = -1; } delete r_pkt; r_pkt = 0; @@ -458,6 +464,7 @@ last_activity = ev_now (); r_pkt = 0; w_pkt = 0; + tos = -1; fd = fd_; #if ENABLE_HTTP_PROXY proxy_req = 0;