Try to fix reconnection

This commit is contained in:
tj 2009-11-27 11:57:42 +01:00
parent fb7dbfd17b
commit 7566c0f963

7
irc.go
View File

@ -193,7 +193,7 @@ func handler(irc *IRCConnection) {
ee.Error = error; ee.Error = error;
ee.Code = ERROR; ee.Code = ERROR;
irc.EventChan <- ee; irc.EventChan <- ee;
go reconnector(irc); reconnector(irc);
} }
} }
} }
@ -226,6 +226,11 @@ func connect(i *IRCConnection) os.Error {
return i.Error return i.Error
} }
fmt.Printf("Connected to %s (%s)\n", i.server, i.socket.RemoteAddr()); fmt.Printf("Connected to %s (%s)\n", i.server, i.socket.RemoteAddr());
i.pread = make(chan string, 100);
i.pwrite = make(chan string, 100);
i.perror = make(chan os.Error, 10);
go reader(i);
go writer(i);
i.pwrite <- fmt.Sprintf("NICK %s\r\n", i.nick); i.pwrite <- fmt.Sprintf("NICK %s\r\n", i.nick);
i.pwrite <- fmt.Sprintf("USER %s 0.0.0.0 0.0.0.0 :GolangBOT\r\n", i.user); i.pwrite <- fmt.Sprintf("USER %s 0.0.0.0 0.0.0.0 :GolangBOT\r\n", i.user);
return nil; return nil;