Skip to content

Commit

Permalink
Merge pull request apache#236 from juliendsv/master
Browse files Browse the repository at this point in the history
s/DefaultPort/Port/
  • Loading branch information
0x6e6562 committed Aug 20, 2014
2 parents 4b86114 + 14c1e97 commit 7bd964e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Fred McCann <[email protected]>
Dan Simmons <[email protected]>
Muir Manders <[email protected]>
Sankar P <[email protected]>
Julien Da Silva <[email protected]>
4 changes: 2 additions & 2 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type ClusterConfig struct {
CQLVersion string // CQL version (default: 3.0.0)
ProtoVersion int // version of the native protocol (default: 2)
Timeout time.Duration // connection timeout (default: 600ms)
DefaultPort int // default port (default: 9042)
Port int // port (default: 9042)
Keyspace string // initial keyspace (optional)
NumConns int // number of connections per host (default: 2)
NumStreams int // number of streams per connection (default: 128)
Expand All @@ -71,7 +71,7 @@ func NewCluster(hosts ...string) *ClusterConfig {
CQLVersion: "3.0.0",
ProtoVersion: 2,
Timeout: 600 * time.Millisecond,
DefaultPort: 9042,
Port: 9042,
NumConns: 2,
NumStreams: 128,
Consistency: Quorum,
Expand Down
6 changes: 3 additions & 3 deletions connectionpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Example of Single Connection Pool:
func NewSingleConnection(cfg *ClusterConfig) ConnectionPool {
addr := strings.TrimSpace(cfg.Hosts[0])
if strings.Index(addr, ":") < 0 {
addr = fmt.Sprintf("%s:%d", addr, cfg.DefaultPort)
addr = fmt.Sprintf("%s:%d", addr, cfg.Port)
}
connCfg := ConnConfig{
ProtoVersion: cfg.ProtoVersion,
Expand Down Expand Up @@ -146,7 +146,7 @@ func NewSimplePool(cfg *ClusterConfig) ConnectionPool {
for i := 0; i < len(cfg.Hosts); i++ {
addr := strings.TrimSpace(cfg.Hosts[i])
if strings.Index(addr, ":") < 0 {
addr = fmt.Sprintf("%s:%d", addr, cfg.DefaultPort)
addr = fmt.Sprintf("%s:%d", addr, cfg.Port)
}

if pool.connect(addr) == nil {
Expand Down Expand Up @@ -236,7 +236,7 @@ func (c *SimplePool) fillPool() {
for host := range c.hosts {
addr := strings.TrimSpace(host)
if strings.Index(addr, ":") < 0 {
addr = fmt.Sprintf("%s:%d", addr, c.cfg.DefaultPort)
addr = fmt.Sprintf("%s:%d", addr, c.cfg.Port)
}

numConns := 1
Expand Down

0 comments on commit 7bd964e

Please sign in to comment.