By making the server socket blocking and improving the read loop, this
avoids a race where read() would get an EAGAIN and abort before any data
was sent.
Add some more error handling and minor style tweaks while I'm here.
Previously:
$ go test ./quagga -run=TestVTYWrite -count=10 -parallel=1
--- FAIL: TestVTYWrite (0.00s)
vty_test.go:186: Server received []byte{}, want []byte{0x74,
0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73,
0x74, 0x0}
FAIL
FAIL github.com/google/seesaw/quagga 0.011s
By making the server socket blocking and improving the read loop, this avoids a race where read() would get an EAGAIN and abort before any data was sent.
Add some more error handling and minor style tweaks while I'm here.
Previously: $ go test ./quagga -run=TestVTYWrite -count=10 -parallel=1 --- FAIL: TestVTYWrite (0.00s) vty_test.go:186: Server received []byte{}, want []byte{0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x0} FAIL FAIL github.com/google/seesaw/quagga 0.011s