Skip to content

Commit

Permalink
remove go routines that would never be killed
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBaZZe committed Jul 11, 2023
1 parent 7af9502 commit 93ac627
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
11 changes: 1 addition & 10 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,16 +614,7 @@ func (srv *Server) setupConn(fd net.Conn, flags connFlag, dialDest *discover.Nod
c.close(errServerStopped)
return
}
timeout := time.NewTimer(dialHistoryExpiration * 9)
defer timeout.Stop()
go func() {
select {
case <-timeout.C:
c.close(DiscReadTimeout)
case <-srv.quit:
c.close(errServerStopped)
}
}()

// Run the encryption handshake.
var err error
if c.id, err = c.doEncHandshake(srv.PrivateKey, dialDest); err != nil {
Expand Down
7 changes: 0 additions & 7 deletions protocol/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,6 @@ func (pm *ProtocolManager) handle(p *peer) error {
// peer. The remote connection is torn down upon returning any error.
func (pm *ProtocolManager) handleMsg(p *peer) error {
// Read the next message from the remote peer, and ensure it's fully consumed
go func() {
select {
case <-pm.quitSync:
p.Disconnect(ErrNoStatusMsg)
}
}()

msg, err := p.rw.ReadMsg()
if err != nil {
return err
Expand Down

0 comments on commit 93ac627

Please sign in to comment.