Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: read goroutine nil pointer panic #235

Merged
merged 7 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acceptor_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (svr *server) listenerRun(lockOSThread bool) {
go func() {
var buffer [0x10000]byte
for {
n, err := c.conn.Read(buffer[:])
n, err := conn.Read(buffer[:])
if err != nil {
_ = c.conn.SetReadDeadline(time.Time{})
_ = conn.SetReadDeadline(time.Time{})
el.ch <- &stderr{c, err}
return
}
Expand Down
6 changes: 5 additions & 1 deletion eventloop_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func (el *eventloop) loopRun(lockOSThread bool) {
case *stdConn:
err = el.loopAccept(v)
case *tcpConn:
if v.c.conn == nil {
panjf2000 marked this conversation as resolved.
Show resolved Hide resolved
break
}
v.c.buffer = v.bb
err = el.loopRead(v.c)
case *udpConn:
Expand Down Expand Up @@ -127,7 +130,8 @@ func (el *eventloop) loopRead(c *stdConn) error {
outFrame, _ := c.codec.Encode(c, out)
el.eventHandler.PreWrite()
if _, err := c.conn.Write(outFrame); err != nil {
return el.loopError(c, err)
err = el.loopError(c, err)
panjf2000 marked this conversation as resolved.
Show resolved Hide resolved
return err
}
}
switch action {
Expand Down