mirror of
https://github.com/golang/go
synced 2024-11-22 00:04:41 -07:00
net: If we stop polling, remove any pending events for the socket
Fixes #1872. R=rsc CC=golang-dev, lars.pensjo https://golang.org/cl/4559046
This commit is contained in:
parent
a1c92c612f
commit
0b8f1ac802
@ -117,6 +117,17 @@ func (p *pollster) DelFD(fd int, mode int) {
|
|||||||
} else {
|
} else {
|
||||||
p.StopWaiting(fd, writeFlags)
|
p.StopWaiting(fd, writeFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Discard any queued up events.
|
||||||
|
i := 0
|
||||||
|
for i < len(p.waitEvents) {
|
||||||
|
if fd == int(p.waitEvents[i].Fd) {
|
||||||
|
copy(p.waitEvents[i:], p.waitEvents[i+1:])
|
||||||
|
p.waitEvents = p.waitEvents[:len(p.waitEvents)-1]
|
||||||
|
} else {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pollster) WaitFD(s *pollServer, nsec int64) (fd int, mode int, err os.Error) {
|
func (p *pollster) WaitFD(s *pollServer, nsec int64) (fd int, mode int, err os.Error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user