func (c *Client) Disconnect(s *Server) {
	if c.Socket.Closed {
		log.Println("Disconnected early")
		//TODO(dan): mark as closed badly
	} else {
		//DEBUG(dan): log.Println(c.Nick, "disconnecting")
		c.Socket.WriteLine("QUIT")
		// wait 'til we get ERROR message back
		var lastLine string
		var totalLines int
		for {
			line, err := c.Socket.Read()
			if err != nil {
				log.Println("Disconnected incorrectly 1:", err.Error())
				log.Println("last line:", totalLines, ":", lastLine)
				//TODO(dan): mark as closed badly
				break
			}
			//DEBUG(dan): log.Println(c.Nick, "got line:", strings.TrimSpace(line))

			msg, err := ircmsg.ParseLine(line)
			if err != nil {
				log.Println("Disconnected incorrectly 2:", err.Error())
				//TODO(dan): mark as closed badly
				break
			}

			// fmt.Println(c.Nick, line)
			lastLine = line
			totalLines++

			if strings.ToUpper(msg.Command) == "ERROR" {
				//TODO(dan): mark as closed nicely
				s.Succeeded++
				break
			}
		}
	}
	c.Socket = nil
}
// Disconnect disconnects from the given server
Disconnect disconnects from the given server
// Disconnect disconnects from the given server
func (c *Client) Disconnect(s *Server) {
	if c.Socket.Closed {
		log.Println("Disconnected early")
	} else {
		c.Socket.WriteLine("QUIT")
		var lastLine string
		var totalLines int
		for {
			line, err := c.Socket.Read()
			if err != nil {
				log.Println("Disconnected incorrectly 1:", err.Error())
				log.Println("last line:", totalLines, ":", lastLine)
				break
			}
			msg, err := ircmsg.ParseLine(line)
			if err != nil {
				log.Println("Disconnected incorrectly 2:", err.Error())
				break
			}
			lastLine = line
			totalLines++
			if strings.ToUpper(msg.Command) == "ERROR" {
				s.Succeeded++
				break
			}
		}
	}
	c.Socket = nil
}
func ( c * Client ) Disconnect ( s * Server ) { if c . Socket . Closed { log . Println ( " " ) } else { c . Socket . WriteLine ( " " ) var lastLine string var totalLines int for { line , err := c . Socket . Read ( ) if err != nil { log . Println ( " " , err . Error ( ) ) log . Println ( " " , totalLines , " " , lastLine ) break } msg , err := ircmsg . ParseLine ( line ) if err != nil { log . Println ( " " , err . Error ( ) ) break } lastLine = line totalLines ++ if strings . ToUpper ( msg . Command ) == " " { s . Succeeded ++ break } } } c . Socket = nil }
Disconnect disconnects from the given server
Disconnect disconnects from the given server
//TODO(dan): mark as closed badly //DEBUG(dan): log.Println(c.Nick, "disconnecting") // wait 'til we get ERROR message back //TODO(dan): mark as closed badly //DEBUG(dan): log.Println(c.Nick, "got line:", strings.TrimSpace(line)) //TODO(dan): mark as closed badly // fmt.Println(c.Nick, line) //TODO(dan): mark as closed nicely