Skip to content

Commit ca7cfe1

Browse files
authored
fix(stream): fix panic of 'No recent network activity' (#22)
* fix(stream): fix panic of 'NO_ERROR: No recent network activity'
1 parent b36ec68 commit ca7cfe1

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

pkg/util/quic.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"log"
1515
"math/big"
1616
"net"
17+
"strings"
1718
"time"
1819

1920
json "github.com/10cella/yomo-json-codec"
@@ -102,11 +103,22 @@ func QuicServer(endpoint string, plugin plugin.YomoObjectPlugin, codec *json.Cod
102103
for {
103104
sess, err := listener.Accept(context.Background())
104105
if err != nil {
105-
panic(err)
106+
if strings.Index(err.Error(), "NO_ERROR") == 0 {
107+
log.Printf("Accept error: %s", err.Error())
108+
continue
109+
} else {
110+
panic(err)
111+
}
106112
}
113+
107114
stream, err := sess.AcceptStream(context.Background())
108115
if err != nil {
109-
panic(err)
116+
if strings.Index(err.Error(), "NO_ERROR") == 0 {
117+
log.Printf("AcceptStream error: %s", err.Error())
118+
continue
119+
} else {
120+
panic(err)
121+
}
110122
}
111123

112124
go io.Copy(YomoFrameworkStreamWriter{plugin.Name(), codec, plugin, stream}, stream) // nolint

0 commit comments

Comments
 (0)