浏览代码

Rebased branch. Fixed code that was altered from the rebase.

Phillip Couto 11 年之前
父节点
当前提交
06eb28df61
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 2 2
      cluster.go
  2. 4 4
      session.go

+ 2 - 2
cluster.go

@@ -58,12 +58,12 @@ func (cfg *ClusterConfig) CreateSession() (*Session, error) {
 
 	//See if there are any connections in the pool
 	if pool.Size() > 0 {
-		s := NewSession(pool, cfg)
+		s := NewSession(pool, *cfg)
 		s.SetConsistency(cfg.Consistency)
 		return s, nil
 	}
 
-	impl.Close()
+	pool.Close()
 	return nil, ErrNoConnectionsStarted
 
 }

+ 4 - 4
session.go

@@ -38,7 +38,7 @@ type Session struct {
 }
 
 // NewSession wraps an existing Node.
-func NewSession(p ConnectionPool, c *ClusterConfig) *Session {
+func NewSession(p ConnectionPool, c ClusterConfig) *Session {
 	return &Session{Pool: p, cons: Quorum, prefetch: 0.25, cfg: c}
 }
 
@@ -100,7 +100,7 @@ func (s *Session) Close() {
 	}
 	s.isClosed = true
 
-	s.Node.Close()
+	s.Pool.Close()
 }
 
 func (s *Session) Closed() bool {
@@ -119,7 +119,7 @@ func (s *Session) executeQuery(qry *Query) *Iter {
 
 	var iter *Iter
 	for count := 0; count <= qry.rt.NumRetries; count++ {
-		conn := s.Node.Pick(qry)
+		conn := s.Pool.Pick(qry)
 
 		//Assign the error unavailable to the iterator
 		if conn == nil {
@@ -154,7 +154,7 @@ func (s *Session) ExecuteBatch(batch *Batch) error {
 
 	var err error
 	for count := 0; count <= batch.rt.NumRetries; count++ {
-		conn := s.Node.Pick(nil)
+		conn := s.Pool.Pick(nil)
 
 		//Assign the error unavailable and break loop
 		if conn == nil {