Add automatic reconnect
This commit is contained in:
parent
db5f5bd9fa
commit
a0409fa8f1
12
irc.go
12
irc.go
@ -30,7 +30,7 @@ func reader(irc *IRCConnection) {
|
|||||||
func writer(irc *IRCConnection) {
|
func writer(irc *IRCConnection) {
|
||||||
for {
|
for {
|
||||||
b := strings.Bytes(<-irc.pwrite);
|
b := strings.Bytes(<-irc.pwrite);
|
||||||
fmt.Printf("-->%s",b );
|
fmt.Printf("-->%s", b);
|
||||||
_, err := irc.socket.Write(b);
|
_, err := irc.socket.Write(b);
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%s\n", err);
|
fmt.Printf("%s\n", err);
|
||||||
@ -45,7 +45,7 @@ func reconnector(i *IRCConnection) {
|
|||||||
for {
|
for {
|
||||||
i.Error = connect(i);
|
i.Error = connect(i);
|
||||||
if i.Error == nil {
|
if i.Error == nil {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,10 +159,10 @@ func (irc *IRCConnection) handle_command(msg string) *IRCEvent {
|
|||||||
case "PING":
|
case "PING":
|
||||||
e.Code = IRC_PING;
|
e.Code = IRC_PING;
|
||||||
e.Message = matches[2];
|
e.Message = matches[2];
|
||||||
// case "ERROR":
|
// case "ERROR":
|
||||||
// e.Code = IRC_PING;
|
// e.Code = IRC_PING;
|
||||||
// e.Message = matches[2];
|
// e.Message = matches[2];
|
||||||
// e.Error = os.ErrorString(matches[2]);
|
// e.Error = os.ErrorString(matches[2]);
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user