()
| 297 | } |
| 298 | |
| 299 | func (p *conn) dropProtectedIfEmtpy() { |
| 300 | if len(p.buf) > 0 || len(p.nextFrame) > 0 { |
| 301 | return |
| 302 | } |
| 303 | // Potentially idle connection, release the read buffer. |
| 304 | p.nextFrame = nil |
| 305 | p.buf = nil |
| 306 | if p.protectedHandle != nil { |
| 307 | readBufPool.Put(p.protectedHandle) |
| 308 | p.protectedHandle = nil |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | // Write encrypts, frames, and writes bytes from b to the underlying connection. |
| 313 | func (p *conn) Write(b []byte) (n int, err error) { |