Browse Source

Fix a bug that a TCPHandler may be shutdown immediately

after creation.

Becuase we put handler.Start() call after timeout check and
lastActivity is initialized in Start(), this will lead to a
incorrect timeout.

Also because we will call handler.Start() right after the
constructor and timeout check, so it makes no difference
where we put the initializtion of lastActivity. We won't do
this again in Start() because DateTime.Now will consumes a
lot of cpu time.
tags/3.3.1
noisyfox 8 years ago
parent
commit
063cf111cb
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      shadowsocks-csharp/Controller/Service/TCPRelay.cs

+ 2
- 1
shadowsocks-csharp/Controller/Service/TCPRelay.cs View File

@@ -173,6 +173,8 @@ namespace Shadowsocks.Controller
this._config = config;
this._tcprelay = tcprelay;
this._connection = socket;
lastActivity = DateTime.Now;
}
public void CreateRemote()
@@ -195,7 +197,6 @@ namespace Shadowsocks.Controller
_firstPacket = firstPacket;
_firstPacketLength = length;
HandshakeReceive();
lastActivity = DateTime.Now;
}
private void CheckClose()


Loading…
Cancel
Save