You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c, err := l.Accept()
desc := netpoll.Must(netpoll.HandleRead(c))
poller.Start(desc, func(ev netpoll.Event) {
if ev&netpoll.EventHup != 0 || ev&netpoll.EventErr != 0 {
// close etc
}
go doSomething(c)
}
Why the code above doesn't "catch" connection error (eg. timeout)?
Also - when I close connection c inside doSomething(c) - the poller doesn't seem to catch that either - which leads me to a question - how to stop poller on error inside doSomething()?
The text was updated successfully, but these errors were encountered:
The file descriptor of the *Desc instance returned by HandleRead is a copy of the connection file descriptor (see net.TCPConn File() method doc). If you close the connection itself, the file description it represents still exists and is not automatically removed from the poller instance. Instead you should either close connection and the *Desc instance or explicitly use the Poller Stop method to detach the FD from the Poller then close connection.
Why the code above doesn't "catch" connection error (eg. timeout)?
Also - when I close connection c inside doSomething(c) - the poller doesn't seem to catch that either - which leads me to a question - how to stop poller on error inside doSomething()?
The text was updated successfully, but these errors were encountered: