Skip to content

Commit

Permalink
fix(conn): connection errors (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjunbiao authored Aug 7, 2020
1 parent 745e505 commit 0456d0d
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions pkg/util/quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"log"
"math/big"
"net"
"strings"
"time"

json "github.com/10cella/yomo-json-codec"
Expand Down Expand Up @@ -103,23 +102,14 @@ func QuicServer(endpoint string, plugin plugin.YomoObjectPlugin, codec *json.Cod
for {
sess, err := listener.Accept(context.Background())
if err != nil {
if strings.Index(err.Error(), "NO_ERROR") == 0 {
log.Printf("Accept error: %s", err.Error())
continue
} else {
panic(err)
}
log.Printf("Accept error: %s", err.Error())
continue
}

stream, err := sess.AcceptStream(context.Background())
if err != nil {
if strings.Index(err.Error(), "NO_ERROR") == 0 ||
strings.Index(err.Error(), "PROTOCOL_VIOLATION") == 0 {
log.Printf("AcceptStream error: %s", err.Error())
continue
} else {
panic(err)
}
log.Printf("AcceptStream error: %s", err.Error())
continue
}

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

0 comments on commit 0456d0d

Please sign in to comment.