good morning!!!!

Skip to content
Snippets Groups Projects
Commit ffc8fc68 authored by Garet Halliday's avatar Garet Halliday
Browse files

prevent double close

parent 5347bf6b
Branches
Tags
1 merge request!37return error to all clients waiting on idreply when connection closes
Pipeline #33424 failed
......@@ -13,6 +13,7 @@ import (
type IdReply struct {
id atomic.Int64
amClosed atomic.Bool
closed chan struct{}
chs map[string]chan msgOrError
......@@ -108,6 +109,9 @@ func (i *IdReply) Closed() <-chan struct{} {
}
func (i *IdReply) Close() error {
if i.amClosed.Swap(true) {
return net.ErrClosed
}
close(i.closed)
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment