disconnect: Clear callbacks before closing channels
This commit is contained in:
		
							parent
							
								
									846881130f
								
							
						
					
					
						commit
						06fee2df7d
					
				
							
								
								
									
										4
									
								
								irc.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								irc.go
									
									
									
									
									
								
							@ -289,6 +289,10 @@ func (irc *Connection) ErrorChan() chan error {
 | 
			
		||||
// A disconnect sends all buffered messages (if possible),
 | 
			
		||||
// stops all goroutines and then closes the socket.
 | 
			
		||||
func (irc *Connection) Disconnect() {
 | 
			
		||||
	for event := range irc.events {
 | 
			
		||||
		irc.ClearCallback(event)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	close(irc.end)
 | 
			
		||||
	close(irc.pwrite)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user