New
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"dragontcp/internal/protocol"
|
||||
"dragontcp/internal/wire"
|
||||
)
|
||||
|
||||
@@ -55,11 +56,13 @@ func (s *streamSession) signalLocked() {
|
||||
func (s *streamSession) touchLocked() { s.lastSeen = time.Now() }
|
||||
|
||||
func (s *streamSession) readTarget() {
|
||||
tmp := make([]byte, 64*1024)
|
||||
ptr := protocol.BufferPool.Get().(*[]byte)
|
||||
tmp := *ptr
|
||||
defer protocol.BufferPool.Put(ptr)
|
||||
for {
|
||||
n, err := s.target.Read(tmp)
|
||||
if n > 0 {
|
||||
data := append([]byte(nil), tmp[:n]...)
|
||||
data := tmp[:n]
|
||||
for len(data) > 0 {
|
||||
s.mu.Lock()
|
||||
for !s.closed && len(s.buf) >= s.maxBuffer {
|
||||
|
||||
Reference in New Issue
Block a user