all: Send Close BEP msg on intentional disconnect (#5440)

This avoids waiting until next ping and timeout until the connection is actually
closed both by notifying the peer of the disconnect and by immediately closing
the local end of the connection after that. As a nice side effect, info level
logging about dropped connections now have the actual reason in it, not a generic
timeout error which looks like a real problem with the connection.
This commit is contained in:
Simon Frei
2019-01-09 17:31:09 +01:00
committed by Jakob Borg
parent d924bd7bd9
commit 24ffd8be99
5 changed files with 99 additions and 52 deletions

View File

@@ -316,11 +316,10 @@ type fakeConnection struct {
mut sync.Mutex
}
func (f *fakeConnection) Close() error {
func (f *fakeConnection) Close(_ error) {
f.mut.Lock()
defer f.mut.Unlock()
f.closed = true
return nil
}
func (f *fakeConnection) Start() {