Quit pingpong when Accept returns error.
@@ -244,7 +244,8 @@ func Server() {
qsess, err := qsock.Accept()
if err != nil {
log.Error("Unable to accept quic session", "err", err)
- continue
+ // Accept failing means the socket is unusable.
+ break
}
log.Debug("Quic session accepted", "src", qsess.RemoteAddr())
go handleClient(qsess)
@@ -266,11 +267,11 @@ func initNetwork() {
func handleClient(qsess quic.Session) {
defer qsess.Close(nil)
qstream, err := qsess.AcceptStream()
- defer qstream.Close()
if err != nil {
log.Error("Unable to accept quic stream", "err", err)
return
}
+ defer qstream.Close()
b := make([]byte, 1<<12)
reqMsgLen := len(ReqMsg)
