Skip to content

Commit

Permalink
Merge pull request #63 from lesismal/poolopt
Browse files Browse the repository at this point in the history
- build
  • Loading branch information
lesismal authored Jul 15, 2021
2 parents 42e1ffa + e7f4970 commit 85f48c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/tls_bench/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ func wrapData(h func(c *nbio.Conn, tlsConn *tls.Conn, data []byte)) func(c *nbio
if isession := c.Session(); isession != nil {
if session, ok := isession.(*Session); ok {
session.Conn.Append(data)
buffer := make([]byte, 2048)
for {
n, err := session.Conn.Read(session.Conn.ReadBuffer)
n, err := session.Conn.Read(buffer)
if err != nil {
c.Close()
return
}
if h != nil && n > 0 {
h(c, session.Conn, session.Conn.ReadBuffer[:n])
h(c, session.Conn, buffer[:n])
}
if n < len(session.Conn.ReadBuffer) {
if n < len(buffer) {
return
}
}
Expand Down Expand Up @@ -124,8 +125,7 @@ func main() {
Buffer: bytes.NewBuffer(),
})
nonBlock := true
readBufferSize := 8192
tlsConn.ResetConn(nbConn, nonBlock, readBufferSize)
tlsConn.ResetConn(nbConn, nonBlock)
g.AddConn(nbConn)

tlsConn.Write(data)
Expand Down

0 comments on commit 85f48c8

Please sign in to comment.