Merge pull request #41 from whd/master
Use tls.DialWithDialer instead of tls.Client and remove irc.netsock
This commit is contained in:
commit
90dc7f966b
9
irc.go
9
irc.go
@ -299,10 +299,6 @@ func (irc *Connection) Disconnect() {
|
|||||||
irc.Wait()
|
irc.Wait()
|
||||||
irc.socket.Close()
|
irc.socket.Close()
|
||||||
irc.socket = nil
|
irc.socket = nil
|
||||||
if irc.netsock != nil {
|
|
||||||
irc.netsock.Close()
|
|
||||||
irc.netsock = nil
|
|
||||||
}
|
|
||||||
irc.ErrorChan() <- ErrDisconnected
|
irc.ErrorChan() <- ErrDisconnected
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,9 +348,8 @@ func (irc *Connection) Connect(server string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if irc.UseTLS {
|
if irc.UseTLS {
|
||||||
if irc.netsock, err = net.DialTimeout("tcp", irc.server, irc.Timeout); err == nil {
|
dialer := &net.Dialer{Timeout: irc.Timeout}
|
||||||
irc.socket = tls.Client(irc.netsock, irc.TLSConfig)
|
irc.socket, err = tls.DialWithDialer(dialer, "tcp", irc.server, irc.TLSConfig)
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
irc.socket, err = net.DialTimeout("tcp", irc.server, irc.Timeout)
|
irc.socket, err = net.DialTimeout("tcp", irc.server, irc.Timeout)
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ type Connection struct {
|
|||||||
KeepAlive time.Duration
|
KeepAlive time.Duration
|
||||||
|
|
||||||
socket net.Conn
|
socket net.Conn
|
||||||
netsock net.Conn
|
|
||||||
pwrite chan string
|
pwrite chan string
|
||||||
end chan struct{}
|
end chan struct{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user