- logger(DEBUG_CONNECTIONS, LOG_WARNING, _("Timeout from %s (%s) during authentication"),
- c->name, c->hostname);
- terminate_connection(c, 0);
+
+ ifdebug(CONNECTIONS) logger(LOG_WARNING, "Timeout from %s (%s) during authentication",
+ c->name, c->hostname);
+
+ if(c->status.connecting) {
+ c->status.connecting = false;
+ closesocket(c->socket);
+ do_outgoing_connection(c);
+ } else {
+ c->status.tarpit = true;
+ terminate_connection(c, false);
+ }
+ }
+ }
+
+ if(c->outbuflen > 0 && c->last_flushed_time + pingtimeout <= now) {
+ if(c->status.active) {
+ ifdebug(CONNECTIONS) logger(LOG_INFO,
+ "%s (%s) could not flush for %ld seconds (%d bytes remaining)",
+ c->name, c->hostname, (long)(now - c->last_flushed_time), c->outbuflen);
+ c->status.timeout = true;
+ terminate_connection(c, true);