fix reading in udp conn

pull/1132/head
Darien Raymond 7 years ago
parent 13f3c356ca
commit 46dbbfff8c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -128,20 +128,23 @@ func (c *udpConn) updateActivity() {
func (c *udpConn) ReadMultiBuffer() (buf.MultiBuffer, error) { func (c *udpConn) ReadMultiBuffer() (buf.MultiBuffer, error) {
var payload buf.MultiBuffer var payload buf.MultiBuffer
select {
case in := <-c.input:
payload.Append(in)
default:
select { select {
case in := <-c.input: case in := <-c.input:
payload.Append(in) payload.Append(in)
case <-c.done.Wait(): case <-c.done.Wait():
return nil, io.EOF return nil, io.EOF
} }
}
L: L:
for { for {
select { select {
case in := <-c.input: case in := <-c.input:
payload.Append(in) payload.Append(in)
case <-c.done.Wait():
break L
default: default:
break L break L
} }

Loading…
Cancel
Save