mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 11:56:53 +00:00
Change BuffSizeCopy pool
This commit is contained in:
@@ -72,7 +72,6 @@ func (s *conn) Read(buf []byte) (n int, err error) {
|
||||
s.Close()
|
||||
return 0, io.EOF
|
||||
} else {
|
||||
//pool.PutBufPoolCopy(s.readBuffer)
|
||||
if node.val == nil {
|
||||
//close
|
||||
s.sendClose = true
|
||||
@@ -91,6 +90,7 @@ func (s *conn) Read(buf []byte) (n int, err error) {
|
||||
} else {
|
||||
n = copy(buf, s.readBuffer[s.startRead:s.endRead])
|
||||
s.startRead += n
|
||||
pool.CopyBuff.Put(s.readBuffer)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func (s *conn) Close() (err error) {
|
||||
return errors.New("the conn has closed")
|
||||
}
|
||||
s.isClose = true
|
||||
pool.PutBufPoolCopy(s.readBuffer)
|
||||
pool.CopyBuff.Put(s.readBuffer)
|
||||
if s.readWait {
|
||||
s.readCh <- struct{}{}
|
||||
}
|
||||
|
@@ -162,8 +162,8 @@ func (s *Mux) readSession() {
|
||||
break
|
||||
}
|
||||
if pack.Flag != 0 && pack.Flag != 7 {
|
||||
if pack.Length>10 {
|
||||
logs.Warn(pack.Flag, pack.Id, pack.Length,string(pack.Content[:10]))
|
||||
if pack.Length > 10 {
|
||||
logs.Warn(pack.Flag, pack.Id, pack.Length, string(pack.Content[:10]))
|
||||
}
|
||||
}
|
||||
s.pingOk = 0
|
||||
@@ -205,7 +205,7 @@ func (s *Mux) readSession() {
|
||||
s.connMap.Delete(pack.Id)
|
||||
}
|
||||
} else if pack.Flag == common.MUX_NEW_MSG {
|
||||
pool.PutBufPoolCopy(pack.Content)
|
||||
pool.CopyBuff.Put(pack.Content)
|
||||
}
|
||||
}
|
||||
s.Close()
|
||||
|
@@ -63,7 +63,7 @@ func (entry *sliceEntry) Clear() bool {
|
||||
return false
|
||||
}
|
||||
for i := 0; i < entry.Size(); i++ {
|
||||
pool.PutBufPoolCopy(entry.element[i].val)
|
||||
pool.CopyBuff.Put(entry.element[i].val)
|
||||
entry.element[i] = nil
|
||||
}
|
||||
entry.element = nil
|
||||
|
Reference in New Issue
Block a user