------------------------------------------ implement net.Conn ------------------------------------------ Read behavior is the same as net.Conn, it will return io.EOF if buffer is empty.
(p []byte)
| 325 | |
| 326 | // Read behavior is the same as net.Conn, it will return io.EOF if buffer is empty. |
| 327 | func (c *connection) Read(p []byte) (n int, err error) { |
| 328 | if len(p) == 0 { |
| 329 | return 0, nil |
| 330 | } |
| 331 | if err = c.waitRead(1); err != nil { |
| 332 | return 0, err |
| 333 | } |
| 334 | return c.inputBuffer.readCopy(p), nil |
| 335 | } |
| 336 | |
| 337 | // Write will Flush soon. |
| 338 | func (c *connection) Write(p []byte) (n int, err error) { |