mirror of https://github.com/ehang-io/nps
add write queue again
parent
51a3787708
commit
3413ceb7c2
|
@ -148,12 +148,7 @@ func (s *conn) Close() (err error) {
|
|||
}
|
||||
|
||||
func (s *conn) closeProcess() {
|
||||
if s.isClose {
|
||||
logs.Warn("has closed ", s.connId)
|
||||
return
|
||||
}
|
||||
s.isClose = true
|
||||
s.readWait = false
|
||||
s.mux.connMap.Delete(s.connId)
|
||||
common.CopyBuff.Put(s.readBuffer)
|
||||
close(s.readCh)
|
||||
|
|
|
@ -41,7 +41,7 @@ func NewMux(c net.Conn, connType string) *Mux {
|
|||
go m.readSession()
|
||||
//ping
|
||||
go m.ping()
|
||||
//go m.writeSession()
|
||||
go m.writeSession()
|
||||
return m
|
||||
}
|
||||
|
||||
|
@ -107,13 +107,13 @@ func (s *Mux) sendInfo(flag uint8, id int32, content []byte) {
|
|||
if pack.Flag == common.MUX_NEW_CONN {
|
||||
logs.Warn("sendinfo mux new conn, insert to write queue", pack.Id)
|
||||
}
|
||||
//s.writeQueue <- buf
|
||||
_, err = buf.WriteTo(s.conn)
|
||||
if err != nil {
|
||||
s.Close()
|
||||
logs.Warn("write err, close mux", err)
|
||||
}
|
||||
common.BuffPool.Put(buf)
|
||||
s.writeQueue <- buf
|
||||
//_, err = buf.WriteTo(s.conn)
|
||||
//if err != nil {
|
||||
// s.Close()
|
||||
// logs.Warn("write err, close mux", err)
|
||||
//}
|
||||
//common.BuffPool.Put(buf)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue