Update Whitelist after the connection is closed

This commit is contained in:
maride 2017-09-28 12:13:03 +02:00
parent 2e17c3616f
commit ffaf2781f5

View File

@ -68,6 +68,13 @@ func gateway_handler(c net.Conn) {
fmt.Println("[OK ] Whitelisted host ", host, " connected")
update_whitelist_time(host)
proxy(c)
update_whitelist_time(host)
// yes, we're updating this before and after.
// why? Consider long TCP connections, e.g. in games
// Then the specified Timeout may be reached before the connection is even closed
// This won't affect this connection (it'll stay open even if the timeout is reached)
// but another connection won't be possible, even if it's right after the closing of
// the first connection. ¯\_(ツ)_/¯
} else {
fmt.Println("[BLK] Blocking host ", host)
}