diff options
author | Felix Lange <fjl@twurst.com> | 2015-05-14 09:04:04 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-05-14 20:53:29 +0800 |
commit | 691cb90284b9b63dc9c80bf0716ba35036ca78fe (patch) | |
tree | dd169615d057af4f35b619c44fb66219760749ba /p2p/peer_test.go | |
parent | 7efeb4bd9647b6ab5376e171c1ff7cb516da5698 (diff) | |
download | go-tangerine-691cb90284b9b63dc9c80bf0716ba35036ca78fe.tar.gz go-tangerine-691cb90284b9b63dc9c80bf0716ba35036ca78fe.tar.zst go-tangerine-691cb90284b9b63dc9c80bf0716ba35036ca78fe.zip |
p2p: log remote reason when disconnect is requested
The returned reason is currently not used except for the log
message. This change makes the log messages a bit more useful.
The handshake code also returns the remote reason.
Diffstat (limited to 'p2p/peer_test.go')
-rw-r--r-- | p2p/peer_test.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/p2p/peer_test.go b/p2p/peer_test.go index fb76818a0..7d17d447c 100644 --- a/p2p/peer_test.go +++ b/p2p/peer_test.go @@ -172,12 +172,13 @@ func TestPeerDisconnect(t *testing.T) { if err := SendItems(rw, discMsg, DiscQuitting); err != nil { t.Fatal(err) } - if err := ExpectMsg(rw, discMsg, []interface{}{DiscRequested}); err != nil { - t.Error(err) - } - closer() - if reason := <-disc; reason != DiscRequested { - t.Errorf("run returned wrong reason: got %v, want %v", reason, DiscRequested) + select { + case reason := <-disc: + if reason != DiscQuitting { + t.Errorf("run returned wrong reason: got %v, want %v", reason, DiscRequested) + } + case <-time.After(500 * time.Millisecond): + t.Error("peer did not return") } } |