tcptee icon indicating copy to clipboard operation
tcptee copied to clipboard

io.Writer implementation needs a nil check

Open pradhanbv opened this issue 8 years ago • 0 comments

To reproduce bug, just remove one of the echo server run command from example.sh, but keep the port in backend list. tcptee will crash if it is told to write to a port nobody is listening on.

I have fixed by adding nil check, this will handle backends which are not always available.

// Write implements the io.Writer. func (b Backends) Write(p []byte) (n int, err error) { for _, conn := range b { if conn != nil { n, err = conn.Write(p) if err != nil { return n, err } } } return }

pradhanbv avatar Nov 29 '16 07:11 pradhanbv