mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
Fix double close
This commit is contained in:
parent
702072f177
commit
34365812d8
@ -63,7 +63,12 @@ func (ms *mockSocket) Send(m *transport.Message) error {
|
||||
}
|
||||
|
||||
func (ms *mockSocket) Close() error {
|
||||
close(ms.exit)
|
||||
select {
|
||||
case <-ms.exit:
|
||||
return nil
|
||||
default:
|
||||
close(ms.exit)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -72,7 +77,12 @@ func (m *mockListener) Addr() string {
|
||||
}
|
||||
|
||||
func (m *mockListener) Close() error {
|
||||
close(m.exit)
|
||||
select {
|
||||
case <-m.exit:
|
||||
return nil
|
||||
default:
|
||||
close(m.exit)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user