UDT: Multiplexer pass down external termination signal. This makes sure any socket reader will return with EOF and does not hang.

Change transferSequenceTimeout to 1 minute which is more appropriate.
This commit is contained in:
Kleissner
2021-12-08 01:36:50 +01:00
parent 34e48c09df
commit 85dcb9d256
2 changed files with 2 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ import (
)
// transferSequenceTimeout is the timeout for a follow-up message to appear, otherwise the transfer will be terminated.
var transferSequenceTimeout = time.Minute * 10
var transferSequenceTimeout = time.Minute * 1
// maxFlowWinSize is the maximum number of unacknowledged packets to permit. A higher number means using more memory, but reduces potential overhead since it does not stop so quickly for missing packets.
// Each unacknowledged packet may store protocol.TransferMaxEmbedSize (currently 1121 bytes) payload data in memory. A too high number may impact the speed of real-time streaming in case of lost packets.

View File

@@ -49,6 +49,7 @@ func (m *multiplexer) goRead() {
select {
case buf = <-m.incomingData:
case <-m.terminationSignal:
m.socket.Close() // Pass the external termination signal down to the socket. This makes sure any pending reader on the socket (especially if blocking) returns with EOF.
return
}