We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e77e438 commit 0c57c7aCopy full SHA for 0c57c7a
1 file changed
zeroconf/zeroconf.go
@@ -27,6 +27,7 @@ type Zeroconf struct {
27
28
listener net.Listener
29
registrar ServiceRegistrar
30
+ closed bool
31
32
dh *dh.DiffieHellman
33
@@ -116,6 +117,11 @@ func (z *Zeroconf) SetCurrentUser(username string) {
116
117
// Close stops the zeroconf responder and HTTP listener,
118
// but does not close the last opened session.
119
func (z *Zeroconf) Close() {
120
+ if z.closed {
121
+ return
122
+ }
123
+
124
+ z.closed = true
125
z.registrar.Shutdown()
126
_ = z.listener.Close()
127
}
@@ -307,6 +313,10 @@ func (z *Zeroconf) Serve(handler HandleNewRequestFunc) error {
307
313
for {
308
314
select {
309
315
case err := <-serveErr:
316
317
+ return nil
318
319
310
320
return err
311
321
case req := <-z.reqsChan:
312
322
req.result <- handler(req)
0 commit comments