Commit 4d0b3662 authored by AlexStocks's avatar AlexStocks Committed by watermelo

Fix: get error cause after server.accept

parent 1e4b65b8
...@@ -13,9 +13,10 @@ import ( ...@@ -13,9 +13,10 @@ import (
"compress/flate" "compress/flate"
"net" "net"
"time" "time"
)
import (
gxsync "github.com/dubbogo/gost/sync" gxsync "github.com/dubbogo/gost/sync"
perrors "github.com/pkg/errors" perrors "github.com/pkg/errors"
) )
......
...@@ -259,7 +259,7 @@ func (s *server) runTcpEventLoop(newSession NewSessionCallback) { ...@@ -259,7 +259,7 @@ func (s *server) runTcpEventLoop(newSession NewSessionCallback) {
} }
client, err = s.accept(newSession) client, err = s.accept(newSession)
if err != nil { if err != nil {
if netErr, ok := err.(net.Error); ok && netErr.Temporary() { if netErr, ok := perrors.Cause(err).(net.Error); ok && netErr.Temporary() {
if delay == 0 { if delay == 0 {
delay = 5 * time.Millisecond delay = 5 * time.Millisecond
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment