Bring in Ray Lu's Debug patches.

This commit is contained in:
Alex Bramley 2010-11-02 21:47:05 +00:00
parent 9b9197f5f6
commit 34b3299d41
1 changed files with 9 additions and 2 deletions

View File

@ -17,6 +17,7 @@ type Conn struct {
// Connection Hostname and Nickname
Host string
Me *Nick
Network string
// I/O stuff to server
sock net.Conn
@ -34,6 +35,8 @@ type Conn struct {
// Set this to true to disable flood protection and false to re-enable
Flood bool
Debug bool
// Event handler mapping
events map[string][]func(*Conn, *Line)
@ -163,9 +166,11 @@ func (conn *Conn) send() {
break
}
conn.io.Flush()
if conn.Debug {
fmt.Println("-> " + line)
}
}
}
// receive one \r\n terminated line from peer, parse and dispatch it
func (conn *Conn) recv() {
@ -177,7 +182,9 @@ func (conn *Conn) recv() {
break
}
s = strings.Trim(s, "\r\n")
if conn.Debug {
fmt.Println("<- " + s)
}
line := &Line{Raw: s}
if s[0] == ':' {