commit
f169aaad6f
22
irc.go
22
irc.go
@ -326,7 +326,8 @@ func (irc *Connection) Reconnect() error {
|
|||||||
// RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.1
|
// RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.1
|
||||||
func (irc *Connection) Connect(server string) error {
|
func (irc *Connection) Connect(server string) error {
|
||||||
irc.Server = server
|
irc.Server = server
|
||||||
irc.stopped = false
|
// mark Server as stopped since there can be an error during connect
|
||||||
|
irc.stopped = true
|
||||||
|
|
||||||
// make sure everything is ready for connection
|
// make sure everything is ready for connection
|
||||||
if len(irc.Server) == 0 {
|
if len(irc.Server) == 0 {
|
||||||
@ -369,6 +370,8 @@ func (irc *Connection) Connect(server string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
irc.stopped = false
|
||||||
irc.Log.Printf("Connected to %s (%s)\n", irc.Server, irc.socket.RemoteAddr())
|
irc.Log.Printf("Connected to %s (%s)\n", irc.Server, irc.socket.RemoteAddr())
|
||||||
|
|
||||||
irc.pwrite = make(chan string, 10)
|
irc.pwrite = make(chan string, 10)
|
||||||
@ -398,14 +401,15 @@ func IRC(nick, user string) *Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
irc := &Connection{
|
irc := &Connection{
|
||||||
nick: nick,
|
nick: nick,
|
||||||
user: user,
|
nickcurrent: nick,
|
||||||
Log: log.New(os.Stdout, "", log.LstdFlags),
|
user: user,
|
||||||
end: make(chan struct{}),
|
Log: log.New(os.Stdout, "", log.LstdFlags),
|
||||||
Version: VERSION,
|
end: make(chan struct{}),
|
||||||
KeepAlive: 4 * time.Minute,
|
Version: VERSION,
|
||||||
Timeout: 1 * time.Minute,
|
KeepAlive: 4 * time.Minute,
|
||||||
PingFreq: 15 * time.Minute,
|
Timeout: 1 * time.Minute,
|
||||||
|
PingFreq: 15 * time.Minute,
|
||||||
}
|
}
|
||||||
irc.setupCallbacks()
|
irc.setupCallbacks()
|
||||||
return irc
|
return irc
|
||||||
|
Loading…
Reference in New Issue
Block a user