Просмотр исходного кода

Fix: monitor heuristic false positive case

Rod Hynes 8 лет назад
Родитель
Сommit
1a57700d7c
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      psiphon/packetTunnelTransport.go

+ 8 - 0
psiphon/packetTunnelTransport.go

@@ -71,6 +71,14 @@ func NewPacketTunnelTransport() *PacketTunnelTransport {
 		stopRunning:  stopRunning,
 		workers:      new(sync.WaitGroup),
 		channelReady: sync.NewCond(new(sync.Mutex)),
+
+		// Initialize lastReadComplete to now to avoid a false positive
+		// in monitoring: lastWriteComplete.Sub(lastReadComplete) will
+		// easily exceed PACKET_TUNNEL_PROBE_SLOW_READ when a write
+		// completes before any read. If lastReadComplete were to be
+		// used by logic other than the monitoring heuristics, this
+		// initial value may need to be revisited.
+		lastReadComplete: int64(monotime.Now()),
 	}
 
 	// The monitor worker will signal the tunnel channel when it