Skip to content

Commit

Permalink
store the hostinfo on the conn it is dialed
Browse files Browse the repository at this point in the history
  • Loading branch information
Zariel committed Dec 25, 2015
1 parent e824767 commit 94f8614
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ type Conn struct {
version uint8
currentKeyspace string
started bool
host *HostInfo

session *Session

Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 94f8614

Please sign in to comment.