nbio: can not reconnect on the tls websocket example

when I have the server running in another shell

$ go run .
2021/05/13 17:11:43 connecting to wss://localhost:8888/wss
2021/05/13 17:11:43 write: hello world
2021/05/13 17:11:43 read : hello world
2021/05/13 17:11:44 write: hello world
2021/05/13 17:11:44 read : hello world
2021/05/13 17:11:45 write: hello world
2021/05/13 17:11:45 read : hello world
2021/05/13 17:11:46 write: hello world
2021/05/13 17:11:46 read : hello world
^Csignal: interrupt
$ go run .
2021/05/13 17:11:49 connecting to wss://localhost:8888/wss
2021/05/13 17:11:49 dial:EOF
exit status 1
$ go run .
2021/05/13 17:11:51 connecting to wss://localhost:8888/wss
2021/05/13 17:11:51 dial:EOF
exit status 1

the server is still running the in the other shell

I am on a mac if that helps

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

created PR with solution

I think I found the problem. You have an infinite loop on func (p *poller) deleteEvent(fd int) , you trigger the readWriteLoop to call c.closeWithError(err), which then again calls func (p *poller) deleteEvent(fd int)