Use conn.ReadMessage instead of irc.Conn.ReadMessage

This commit is contained in:
Simon Ser 2020-04-03 17:01:25 +02:00
parent 0dc007cd45
commit e1931649e4
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 2 additions and 10 deletions

View File

@ -731,15 +731,11 @@ func (dc *downstreamConn) runNetwork(net *network, loadHistory bool) {
func (dc *downstreamConn) runUntilRegistered() error { func (dc *downstreamConn) runUntilRegistered() error {
for !dc.registered { for !dc.registered {
msg, err := dc.irc.ReadMessage() msg, err := dc.ReadMessage()
if err != nil { if err != nil {
return fmt.Errorf("failed to read IRC command: %v", err) return fmt.Errorf("failed to read IRC command: %v", err)
} }
if dc.srv.Debug {
dc.logger.Printf("received: %v", msg)
}
err = dc.handleMessage(msg) err = dc.handleMessage(msg)
if ircErr, ok := err.(ircError); ok { if ircErr, ok := err.(ircError); ok {
ircErr.Message.Prefix = dc.srv.prefix() ircErr.Message.Prefix = dc.srv.prefix()

View File

@ -1278,15 +1278,11 @@ func (uc *upstreamConn) register() {
func (uc *upstreamConn) runUntilRegistered() error { func (uc *upstreamConn) runUntilRegistered() error {
for !uc.registered { for !uc.registered {
msg, err := uc.irc.ReadMessage() msg, err := uc.ReadMessage()
if err != nil { if err != nil {
return fmt.Errorf("failed to read message: %v", err) return fmt.Errorf("failed to read message: %v", err)
} }
if uc.srv.Debug {
uc.logger.Printf("received: %v", msg)
}
if err := uc.handleMessage(msg); err != nil { if err := uc.handleMessage(msg); err != nil {
return fmt.Errorf("failed to handle message %q: %v", msg, err) return fmt.Errorf("failed to handle message %q: %v", msg, err)
} }