Here var timeout is fixed, thus subsequent calls to SetDeadline() after AcceptKCP() will not be able to change the listener's timeout.
lis.SetDeadline(time.Now().Add(10 * time.Second)) // OK
conn, _ := lis.AcceptKCP()
go func() {
<-time.After(5 * time.Second)
lis.SetDeadline(time.Now().Add(10 * time.Second)) // Has no effect
}()
From a naive understanding of the go document, calling SetReadDeadline() should be able to extend the deadline of the underlying connection.
https://golang.org/pkg/net/#PacketConn
https://github.com/xtaci/kcp-go/blob/88fc14ae6dc5ff6eed704407e5f72ff0d28a7013/sess.go#L913-L918
Here
var timeout
is fixed, thus subsequent calls toSetDeadline()
afterAcceptKCP()
will not be able to change the listener's timeout.From a naive understanding of the go document, calling
SetReadDeadline()
should be able to extend the deadline of the underlying connection. https://golang.org/pkg/net/#PacketConn