mirror of
https://github.com/ehang-io/nps.git
synced 2025-07-03 04:53:50 +00:00
remove mux connection deadline
This commit is contained in:
parent
453d36f658
commit
231ba13e8c
@ -34,6 +34,7 @@ type Mux struct {
|
|||||||
func NewMux(c net.Conn, connType string) *Mux {
|
func NewMux(c net.Conn, connType string) *Mux {
|
||||||
//c.(*net.TCPConn).SetReadBuffer(0)
|
//c.(*net.TCPConn).SetReadBuffer(0)
|
||||||
//c.(*net.TCPConn).SetWriteBuffer(0)
|
//c.(*net.TCPConn).SetWriteBuffer(0)
|
||||||
|
_ = c.SetDeadline(time.Time{})
|
||||||
m := &Mux{
|
m := &Mux{
|
||||||
conn: c,
|
conn: c,
|
||||||
connMap: NewConnMap(),
|
connMap: NewConnMap(),
|
||||||
@ -173,7 +174,7 @@ func (s *Mux) ping() {
|
|||||||
s.sendInfo(common.MUX_PING_FLAG, common.MUX_PING, now)
|
s.sendInfo(common.MUX_PING_FLAG, common.MUX_PING, now)
|
||||||
// send the ping flag and get the latency first
|
// send the ping flag and get the latency first
|
||||||
ticker := time.NewTicker(time.Second * 5)
|
ticker := time.NewTicker(time.Second * 5)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
if s.IsClose {
|
if s.IsClose {
|
||||||
break
|
break
|
||||||
@ -198,7 +199,7 @@ func (s *Mux) ping() {
|
|||||||
}
|
}
|
||||||
atomic.AddUint32(&s.pingOk, 1)
|
atomic.AddUint32(&s.pingOk, 1)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user