add write queue again

module
ffdfgdfg 2019-09-02 00:18:52 +08:00
parent 51a3787708
commit 3413ceb7c2
2 changed files with 8 additions and 13 deletions

View File

@ -148,12 +148,7 @@ func (s *conn) Close() (err error) {
} }
func (s *conn) closeProcess() { func (s *conn) closeProcess() {
if s.isClose {
logs.Warn("has closed ", s.connId)
return
}
s.isClose = true s.isClose = true
s.readWait = false
s.mux.connMap.Delete(s.connId) s.mux.connMap.Delete(s.connId)
common.CopyBuff.Put(s.readBuffer) common.CopyBuff.Put(s.readBuffer)
close(s.readCh) close(s.readCh)

View File

@ -41,7 +41,7 @@ func NewMux(c net.Conn, connType string) *Mux {
go m.readSession() go m.readSession()
//ping //ping
go m.ping() go m.ping()
//go m.writeSession() go m.writeSession()
return m return m
} }
@ -107,13 +107,13 @@ func (s *Mux) sendInfo(flag uint8, id int32, content []byte) {
if pack.Flag == common.MUX_NEW_CONN { if pack.Flag == common.MUX_NEW_CONN {
logs.Warn("sendinfo mux new conn, insert to write queue", pack.Id) logs.Warn("sendinfo mux new conn, insert to write queue", pack.Id)
} }
//s.writeQueue <- buf s.writeQueue <- buf
_, err = buf.WriteTo(s.conn) //_, err = buf.WriteTo(s.conn)
if err != nil { //if err != nil {
s.Close() // s.Close()
logs.Warn("write err, close mux", err) // logs.Warn("write err, close mux", err)
} //}
common.BuffPool.Put(buf) //common.BuffPool.Put(buf)
return return
} }