diff options
| author | Přemysl Janouch <p@janouch.name> | 2018-08-03 10:55:22 +0200 | 
|---|---|---|
| committer | Přemysl Janouch <p@janouch.name> | 2018-08-03 10:55:22 +0200 | 
| commit | 9b6c4e7028943dc97533aa8a1ee6322b913ccaca (patch) | |
| tree | 30aeb7c32d579baea4af66e660929efd295e9d9b /hid | |
| parent | 2e427c2ceae13ca5c8083cb306395014fdc25add (diff) | |
| download | haven-9b6c4e7028943dc97533aa8a1ee6322b913ccaca.tar.gz haven-9b6c4e7028943dc97533aa8a1ee6322b913ccaca.tar.xz haven-9b6c4e7028943dc97533aa8a1ee6322b913ccaca.zip | |
hid: fix listener shutdown
Diffstat (limited to 'hid')
| -rw-r--r-- | hid/main.go | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/hid/main.go b/hid/main.go index 39453f9..5d498aa 100644 --- a/hid/main.go +++ b/hid/main.go @@ -931,7 +931,7 @@ func (c *client) unregister(reason string) {  	ircNotifyRoommates(c, fmt.Sprintf(":%s!%s@%s QUIT :%s",  		c.nickname, c.username, c.hostname, reason)) -	// The eventual QUIT message will take care of state at clients. +	// The QUIT message will take care of state on clients.  	for _, ch := range channels {  		delete(ch.userModes, c)  		ircChannelDestroyIfEmpty(ch) @@ -2949,6 +2949,13 @@ func accept(ln net.Listener) {  	for {  		// Error handling here may be tricky, see go #6163, #24808.  		if conn, err := ln.Accept(); err != nil { +			// See go #4373, they're being dicks. Another solution would be to +			// pass a done channel to this function and close it before closing +			// all the listeners, returning from here if it's readable. +			if strings.Contains(err.Error(), +				"use of closed network connection") { +				return +			}  			if op, ok := err.(net.Error); !ok || !op.Temporary() {  				log.Fatalln(err)  			} else { | 
