From 9d322aca1a42329651e50c8b962735844fddbe25 Mon Sep 17 00:00:00 2001 From: tj Date: Tue, 5 Apr 2011 10:37:17 +0200 Subject: [PATCH] Compabillity fixes for new go core version --- irc.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/irc.go b/irc.go index 11396e5..60872c8 100644 --- a/irc.go +++ b/irc.go @@ -59,17 +59,18 @@ func reader(irc *IRCConnection) { } func writer(irc *IRCConnection) { - for !error && !closed(irc.pwrite) { - b := []byte(<-irc.pwrite) - if b == nil || irc.socket == nil { + b, ok := <-irc.pwrite + for !error && ok { + if b == "" || irc.socket == nil { break } - _, err := irc.socket.Write(b) + _, err := irc.socket.Write([]byte(b)) if err != nil { fmt.Printf("%s\n", err) irc.Error <- err break } + b, ok = <-irc.pwrite } irc.syncwriter <- true } @@ -135,7 +136,7 @@ func (i *IRCConnection) Reconnect() os.Error { for { fmt.Printf("Reconnecting to %s\n", i.server) var err os.Error - i.socket, err = net.Dial("tcp", "", i.server) + i.socket, err = net.Dial("tcp", i.server) if err == nil { break } @@ -170,7 +171,7 @@ func (i *IRCConnection) Connect(server string) os.Error { i.server = server fmt.Printf("Connecting to %s\n", i.server) var err os.Error - i.socket, err = net.Dial("tcp", "", i.server) + i.socket, err = net.Dial("tcp", i.server) if err != nil { return err }