mirror of https://github.com/fluffle/goirc
Moved timeout to Client from Connect
This commit is contained in:
parent
dde47a6a32
commit
5e5f5f0253
|
@ -128,6 +128,7 @@ func Client(cfg *Config) *Conn {
|
||||||
}
|
}
|
||||||
|
|
||||||
dialer := new(net.Dialer)
|
dialer := new(net.Dialer)
|
||||||
|
dialer.Timeout = cfg.Timeout
|
||||||
if cfg.LocalAddr != "" {
|
if cfg.LocalAddr != "" {
|
||||||
if !hasPort(cfg.LocalAddr) {
|
if !hasPort(cfg.LocalAddr) {
|
||||||
cfg.LocalAddr += ":0"
|
cfg.LocalAddr += ":0"
|
||||||
|
@ -227,7 +228,6 @@ func (conn *Conn) Connect() error {
|
||||||
if conn.connected {
|
if conn.connected {
|
||||||
return fmt.Errorf("irc.Connect(): Cannot connect to %s, already connected.", conn.cfg.Server)
|
return fmt.Errorf("irc.Connect(): Cannot connect to %s, already connected.", conn.cfg.Server)
|
||||||
}
|
}
|
||||||
conn.dialer.Timeout = conn.cfg.Timeout
|
|
||||||
if conn.cfg.SSL {
|
if conn.cfg.SSL {
|
||||||
if !hasPort(conn.cfg.Server) {
|
if !hasPort(conn.cfg.Server) {
|
||||||
conn.cfg.Server = net.JoinHostPort(conn.cfg.Server, "6697")
|
conn.cfg.Server = net.JoinHostPort(conn.cfg.Server, "6697")
|
||||||
|
|
Loading…
Reference in New Issue