hid: fix listener shutdown
This commit is contained in:
		
							parent
							
								
									9ee07873ea
								
							
						
					
					
						commit
						ab66a60703
					
				| @ -931,7 +931,7 @@ func (c *client) unregister(reason string) { | |||||||
| 	ircNotifyRoommates(c, fmt.Sprintf(":%s!%s@%s QUIT :%s", | 	ircNotifyRoommates(c, fmt.Sprintf(":%s!%s@%s QUIT :%s", | ||||||
| 		c.nickname, c.username, c.hostname, reason)) | 		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 { | 	for _, ch := range channels { | ||||||
| 		delete(ch.userModes, c) | 		delete(ch.userModes, c) | ||||||
| 		ircChannelDestroyIfEmpty(ch) | 		ircChannelDestroyIfEmpty(ch) | ||||||
| @ -2949,6 +2949,13 @@ func accept(ln net.Listener) { | |||||||
| 	for { | 	for { | ||||||
| 		// Error handling here may be tricky, see go #6163, #24808. | 		// Error handling here may be tricky, see go #6163, #24808. | ||||||
| 		if conn, err := ln.Accept(); err != nil { | 		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() { | 			if op, ok := err.(net.Error); !ok || !op.Temporary() { | ||||||
| 				log.Fatalln(err) | 				log.Fatalln(err) | ||||||
| 			} else { | 			} else { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user