func (s *Server) reader() { for { line, prefix, err := s.buf.ReadLine() if err != nil { logger.Error(err) //TODO allow reconnect close(s.sendq) <-s.endq close(s.endq) s.connected = false s.context.dead <- s return } if prefix { logger.Warning("Network overflow; ignoring line") continue } logger.Debugf("-> %s", line) if len(line) == 0 { continue } l := irc.ParseLine(string(line)) if l != nil { s.handle(l) } } }
func (s *server) reader() { for { line, prefix, err := s.buf.ReadLine() if err != nil { log.Fatal("Read error: ", err) } if prefix { log.Printf("Network overflow (%q) -- ignoring", line) } if len(line) == 0 { continue } l := irc.ParseLine(string(line)) if l != nil { if logReads { log.Println(l.Raw) } s.handleLine(l) } } }