Compabillity fixes for new go core version

This commit is contained in:
tj 2011-04-05 10:37:17 +02:00
parent ea8495857e
commit 9d322aca1a

13
irc.go
View File

@ -59,17 +59,18 @@ func reader(irc *IRCConnection) {
} }
func writer(irc *IRCConnection) { func writer(irc *IRCConnection) {
for !error && !closed(irc.pwrite) { b, ok := <-irc.pwrite
b := []byte(<-irc.pwrite) for !error && ok {
if b == nil || irc.socket == nil { if b == "" || irc.socket == nil {
break break
} }
_, err := irc.socket.Write(b) _, err := irc.socket.Write([]byte(b))
if err != nil { if err != nil {
fmt.Printf("%s\n", err) fmt.Printf("%s\n", err)
irc.Error <- err irc.Error <- err
break break
} }
b, ok = <-irc.pwrite
} }
irc.syncwriter <- true irc.syncwriter <- true
} }
@ -135,7 +136,7 @@ func (i *IRCConnection) Reconnect() os.Error {
for { for {
fmt.Printf("Reconnecting to %s\n", i.server) fmt.Printf("Reconnecting to %s\n", i.server)
var err os.Error var err os.Error
i.socket, err = net.Dial("tcp", "", i.server) i.socket, err = net.Dial("tcp", i.server)
if err == nil { if err == nil {
break break
} }
@ -170,7 +171,7 @@ func (i *IRCConnection) Connect(server string) os.Error {
i.server = server i.server = server
fmt.Printf("Connecting to %s\n", i.server) fmt.Printf("Connecting to %s\n", i.server)
var err os.Error var err os.Error
i.socket, err = net.Dial("tcp", "", i.server) i.socket, err = net.Dial("tcp", i.server)
if err != nil { if err != nil {
return err return err
} }