Skip to content

Commit

Permalink
fix:bind local udp port error causes program to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlh committed Feb 10, 2020
1 parent a12a105 commit c68a1e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ func (s *TRPClient) handleChan(src net.Conn) {
func (s *TRPClient) handleUdp(serverConn net.Conn) {
// bind a local udp port
local, err := net.ListenUDP("udp", nil)
defer local.Close()
defer serverConn.Close()
if err != nil {
logs.Error("bind local udp port error ", err.Error())
return
}
defer local.Close()
go func() {
defer serverConn.Close()
b := common.BufPoolUdp.Get().([]byte)
Expand Down

0 comments on commit c68a1e8

Please sign in to comment.