diff --git a/eventloop_unix_test.go b/eventloop_unix_test.go index e21bb83f1..c166dde0a 100644 --- a/eventloop_unix_test.go +++ b/eventloop_unix_test.go @@ -275,7 +275,7 @@ func (s *testServerGC) GC(secs int) { runtime.GC() gcTime := time.Since(now) gcAllTime += gcTime - s.tester.Log(s.tester.Name(), s.network, " server gc:", gcTime, ", average gc time:", gcAllTime/gcAllCount) + s.tester.Log(s.tester.Name(), s.network, "server gc:", gcTime, "average gc time:", gcAllTime/gcAllCount) if time.Since(gcStart) >= time.Second*time.Duration(secs) { break } diff --git a/gnet.go b/gnet.go index 3e2d9ab9a..99f6f4038 100644 --- a/gnet.go +++ b/gnet.go @@ -293,8 +293,6 @@ type Socket interface { // algorithm). // The default is true (no delay), meaning that data is sent as soon as possible after a Write. SetNoDelay(noDelay bool) error - // CloseRead() error - // CloseWrite() error } // Conn is an interface of underlying connection. diff --git a/gnet_test.go b/gnet_test.go index 50abb6e0c..e26f085fb 100644 --- a/gnet_test.go +++ b/gnet_test.go @@ -1206,9 +1206,15 @@ type testStopServer struct { *BuiltinEventEngine tester *testing.T network, addr, protoAddr string + eng Engine action bool } +func (t *testStopServer) OnBoot(eng Engine) (action Action) { + t.eng = eng + return +} + func (t *testStopServer) OnClose(Conn, error) (action Action) { logging.Debugf("closing connection...") return @@ -1237,7 +1243,7 @@ func (t *testStopServer) OnTick() (delay time.Duration, action Action) { go func() { ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() - logging.Debugf("stop engine...", Stop(ctx, t.protoAddr)) + logging.Debugf("stop engine...", t.eng.Stop(ctx)) }() // waiting the engine shutdown. @@ -1365,7 +1371,7 @@ type testClosedWakeUpServer struct { clientClosed chan struct{} } -func (s *testClosedWakeUpServer) OnBoot(_ Engine) (action Action) { +func (s *testClosedWakeUpServer) OnBoot(eng Engine) (action Action) { go func() { c, err := net.Dial(s.network, s.addr) require.NoError(s.tester, err) @@ -1380,7 +1386,7 @@ func (s *testClosedWakeUpServer) OnBoot(_ Engine) (action Action) { close(s.clientClosed) <-s.serverClosed - logging.Debugf("stop engine...", Stop(context.TODO(), s.protoAddr)) + logging.Debugf("stop engine...", eng.Stop(context.TODO())) }() return None diff --git a/pkg/errors/errors.go b/pkg/errors/errors.go index 835ddedf0..3aaf1b6ba 100644 --- a/pkg/errors/errors.go +++ b/pkg/errors/errors.go @@ -35,8 +35,6 @@ var ( ErrUnsupportedUDPProtocol = errors.New("gnet: only udp/udp4/udp6 are supported") // ErrUnsupportedUDSProtocol occurs when trying to use an unsupported Unix protocol. ErrUnsupportedUDSProtocol = errors.New("gnet: only unix is supported") - // ErrUnsupportedPlatform occurs when running gnet on an unsupported platform. - ErrUnsupportedPlatform = errors.New("gnet: unsupported platform in gnet") // ErrUnsupportedOp occurs when calling some methods that has not been implemented yet. ErrUnsupportedOp = errors.New("gnet: unsupported operation") // ErrNegativeSize occurs when trying to pass a negative size to a buffer.