Keep reading until something causes the connection to die (EOF, server closed, etc). Useful as a tool for mindlessly keeping the connection healthy, since the client will error if things like client prefaces are not accepted in a timely fashion.
(conn net.Conn)
| 1016 | // healthy, since the client will error if things like client prefaces are not |
| 1017 | // accepted in a timely fashion. |
| 1018 | func keepReading(conn net.Conn) { |
| 1019 | buf := make([]byte, 1024) |
| 1020 | for _, err := conn.Read(buf); err == nil; _, err = conn.Read(buf) { |
| 1021 | } |
| 1022 | } |
| 1023 | |
| 1024 | // stayConnected makes cc stay connected by repeatedly calling cc.Connect() |
| 1025 | // until the state becomes Shutdown or until 10 seconds elapses. |
no test coverage detected