Fix double close

This commit is contained in:
Asim 2016-06-03 11:08:58 +01:00
parent 702072f177
commit 34365812d8

View File

@ -63,7 +63,12 @@ func (ms *mockSocket) Send(m *transport.Message) error {
} }
func (ms *mockSocket) Close() error { func (ms *mockSocket) Close() error {
select {
case <-ms.exit:
return nil
default:
close(ms.exit) close(ms.exit)
}
return nil return nil
} }
@ -72,7 +77,12 @@ func (m *mockListener) Addr() string {
} }
func (m *mockListener) Close() error { func (m *mockListener) Close() error {
select {
case <-m.exit:
return nil
default:
close(m.exit) close(m.exit)
}
return nil return nil
} }