peer: ensure goroutine launched during initial handshake exits

This commit fixes a bug which was covered by the recent server
refactoring wherein the grouting would be stuck on the send over the
message channel in the case that the handshake failed. This blockage
would create a deadlock now that the ConnectToPeer method is full
synchronous.

We fix this issue by ensuring the goroutine properly exits.
This commit is contained in:
Olaoluwa Osuntokun 2017-08-10 18:07:45 -07:00
parent 84a0806da4
commit a2545d85dc
No known key found for this signature in database
GPG Key ID: 3D0A94DB79743DF5
1 changed files with 1 additions and 0 deletions

View File

@ -216,6 +216,7 @@ func (p *peer) Start() error {
if err != nil {
readErr <- err
msgChan <- nil
return
}
readErr <- nil
msgChan <- msg