diff options
author | unai.avila <uavila@fonyou.com> | 2014-08-20 10:55:54 +0200 |
---|---|---|
committer | unai.avila <uavila@fonyou.com> | 2014-08-20 10:55:54 +0200 |
commit | 6f4418750e67c72641a4373ab580b306b0c9304c (patch) | |
tree | ca8ee29ac38ed6444e884a8b3ec6476a7adfe5c4 | |
parent | Added unbind method (diff) | |
download | ldap-6f4418750e67c72641a4373ab580b306b0c9304c.tar ldap-6f4418750e67c72641a4373ab580b306b0c9304c.tar.gz ldap-6f4418750e67c72641a4373ab580b306b0c9304c.tar.bz2 ldap-6f4418750e67c72641a4373ab580b306b0c9304c.tar.lz ldap-6f4418750e67c72641a4373ab580b306b0c9304c.tar.xz ldap-6f4418750e67c72641a4373ab580b306b0c9304c.tar.zst ldap-6f4418750e67c72641a4373ab580b306b0c9304c.zip |
-rw-r--r-- | conn.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -54,6 +54,18 @@ func Dial(network, addr string) (*Conn, error) { return conn, nil } +// DialTimeout connects to the given address on the given network using net.DialTimeout +// and then returns a new Conn for the connection. Acts like Dial but takes a timeout. +func DialTimeout(network, addr string, timeout time.Duration) (*Conn, error) { + c, err := net.DialTimeout(network, addr, timeout) + if err != nil { + return nil, NewError(ErrorNetwork, err) + } + conn := NewConn(c) + conn.start() + return conn, nil +} + // DialTLS connects to the given address on the given network using tls.Dial // and then returns a new Conn for the connection. func DialTLS(network, addr string, config *tls.Config) (*Conn, error) { |