Skip to content
This repository has been archived by the owner on Apr 3, 2021. It is now read-only.

Commit

Permalink
Enlarge pending buffer and nil it after use (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyc9012 committed Apr 9, 2020
1 parent ca0c721 commit 7492950
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/udp_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func newUDPConn(pcb *C.struct_udp_pcb, handler UDPConnHandler, localIP C.ip_addr
localIP: localIP,
localPort: localPort,
state: udpConnecting,
pending: make(chan *udpPacket, 1), // To hold the first packet on the connection
pending: make(chan *udpPacket, 64), // To hold the early packets on the connection
}

go func() {
Expand All @@ -68,6 +68,7 @@ func newUDPConn(pcb *C.struct_udp_pcb, handler UDPConnHandler, localIP C.ip_addr
}
continue DrainPending
default:
conn.pending = nil
break DrainPending
}
}
Expand Down

0 comments on commit 7492950

Please sign in to comment.