NTCP: Fix sending termination on idle timeout (ticket #2777)

This commit is contained in:
zzz
2020-10-12 13:29:46 +00:00
parent f028002c11
commit 010bb0a2fe
2 changed files with 5 additions and 3 deletions

View File

@ -302,8 +302,8 @@ class EventPumper implements Runnable {
if ( con.getTimeSinceSend(now) > expire &&
con.getTimeSinceReceive(now) > expire) {
// we haven't sent or received anything in a really long time, so lets just close 'er up
// con will cancel the key
con.sendTerminationAndClose();
key.cancel();
if (_log.shouldInfo())
_log.info("Failsafe or expire close for " + con);
failsafeCloses++;

View File

@ -1043,8 +1043,8 @@ public class NTCPConnection implements Closeable {
/**
* NTCP 1 or 2.
* For NTCP1, sends termination and then closes the connection after a brief delay.
* For NTCP2, simply closes the connection immediately.
* For NTCP1, simply closes the connection immediately.
* For NTCP2, sends termination and then closes the connection after a brief delay.
*
* @since 0.9.36
*/
@ -1066,6 +1066,8 @@ public class NTCPConnection implements Closeable {
* @since 0.9.36
*/
private void sendTermination(int reason, int validFramesRcvd) {
// So we don't get called again by the event pumper idle closer
_lastSendTime = _context.clock().now();
// TODO add param to clear queues?
// no synch needed, sendNTCP2() is synched
if (_log.shouldInfo())