Skip to content

Commit

Permalink
Fix CI failures on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed Dec 4, 2024
1 parent 213e164 commit e96bcf4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions acceptor_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"errors"
"net"
"runtime"
"sync/atomic"

errorx "github.com/panjf2000/gnet/v2/pkg/errors"
)
Expand All @@ -36,7 +35,7 @@ func (eng *engine) listenStream(ln net.Listener) (err error) {
tc, e := ln.Accept()
if e != nil {
err = e
if atomic.LoadInt32(&eng.beingShutdown) == 0 {
if !eng.beingShutdown.Load() {
eng.opts.Logger.Errorf("Accept() fails due to error: %v", err)
} else if errors.Is(err, net.ErrClosed) {
err = errors.Join(err, errorx.ErrEngineShutdown)
Expand Down Expand Up @@ -74,7 +73,7 @@ func (eng *engine) ListenUDP(pc net.PacketConn) (err error) {
n, addr, e := pc.ReadFrom(buffer[:])
if e != nil {
err = e
if atomic.LoadInt32(&eng.beingShutdown) == 0 {
if !eng.beingShutdown.Load() {
eng.opts.Logger.Errorf("failed to receive data from UDP fd due to error:%v", err)
} else if errors.Is(err, net.ErrClosed) {
err = errors.Join(err, errorx.ErrEngineShutdown)
Expand Down

0 comments on commit e96bcf4

Please sign in to comment.