mirror of
				https://github.com/fluffle/goirc
				synced 2025-11-04 03:58:03 +00:00 
			
		
		
		
	Merge 19815ba792 into 0cac69d2ee
				
					
				
			This commit is contained in:
		
						commit
						fd5200891e
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -4,13 +4,14 @@ import (
 | 
				
			||||||
	"bufio"
 | 
						"bufio"
 | 
				
			||||||
	"crypto/tls"
 | 
						"crypto/tls"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"github.com/fluffle/goirc/logging"
 | 
					 | 
				
			||||||
	"github.com/fluffle/goirc/state"
 | 
					 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/fluffle/goirc/logging"
 | 
				
			||||||
 | 
						"github.com/fluffle/goirc/state"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// An IRC connection is represented by this struct.
 | 
					// An IRC connection is represented by this struct.
 | 
				
			||||||
| 
						 | 
					@ -404,7 +405,6 @@ func (conn *Conn) shutdown() {
 | 
				
			||||||
	// Guard against double-call of shutdown() if we get an error in send()
 | 
						// Guard against double-call of shutdown() if we get an error in send()
 | 
				
			||||||
	// as calling sock.Close() will cause recv() to receive EOF in readstring()
 | 
						// as calling sock.Close() will cause recv() to receive EOF in readstring()
 | 
				
			||||||
	conn.mu.Lock()
 | 
						conn.mu.Lock()
 | 
				
			||||||
	defer conn.mu.Unlock()
 | 
					 | 
				
			||||||
	if !conn.connected {
 | 
						if !conn.connected {
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -412,6 +412,8 @@ func (conn *Conn) shutdown() {
 | 
				
			||||||
	conn.connected = false
 | 
						conn.connected = false
 | 
				
			||||||
	conn.sock.Close()
 | 
						conn.sock.Close()
 | 
				
			||||||
	close(conn.die)
 | 
						close(conn.die)
 | 
				
			||||||
 | 
						// Unlock before waiting, https://github.com/StalkR/goircbot/issues/11
 | 
				
			||||||
 | 
						conn.mu.Unlock()
 | 
				
			||||||
	conn.wg.Wait()
 | 
						conn.wg.Wait()
 | 
				
			||||||
	// Dispatch after closing connection but before reinit
 | 
						// Dispatch after closing connection but before reinit
 | 
				
			||||||
	// so event handlers can still access state information.
 | 
						// so event handlers can still access state information.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue