From 94f8614b245fd3a0e3d2d9ca892ec4892c61877d Mon Sep 17 00:00:00 2001 From: Chris Bannister Date: Fri, 25 Dec 2015 20:36:27 +0000 Subject: [PATCH] store the hostinfo on the conn it is dialed --- conn.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conn.go b/conn.go index 13aa7be1d..24114e452 100644 --- a/conn.go +++ b/conn.go @@ -131,6 +131,7 @@ type Conn struct { version uint8 currentKeyspace string started bool + host *HostInfo session *Session @@ -191,6 +192,13 @@ func Connect(addr string, cfg *ConnConfig, errorHandler ConnErrorHandler, sessio streams: streams.New(cfg.ProtoVersion), } + host, _, err := net.SplitHostPort(addr) + if err != nil { + conn.Close() + return nil, err + } + c.host = session.ring.getHost(host) + if cfg.Keepalive > 0 { c.setKeepalive(cfg.Keepalive) }