Godeps/_workspace/src/gopkg.in/mgo.v2/socket.go
func (socket *mongoSocket) InitialAcquire(serverInfo *mongoServerInfo, timeout time.Duration) error {
	socket.Lock()
	if socket.references > 0 {
		panic("Socket acquired out of cache with references")
	}
	if socket.dead != nil {
		dead := socket.dead
		socket.Unlock()
		return dead
	}
	socket.references++
	socket.serverInfo = serverInfo
	socket.timeout = timeout
	stats.socketsInUse(+1)
	stats.socketRefs(+1)
	socket.Unlock()
	return nil
}
func (socket *mongoSocket) InitialAcquire(serverInfo *mongoServerInfo, timeout time.Duration) error {
	socket.Lock()
	if socket.references > 0 {
		panic("Socket acquired out of cache with references")
	}
	if socket.dead != nil {
		dead := socket.dead
		socket.Unlock()
		return dead
	}
	socket.references++
	socket.serverInfo = serverInfo
	socket.timeout = timeout
	stats.socketsInUse(+1)
	stats.socketRefs(+1)
	socket.Unlock()
	return nil
}
func ( socket * mongoSocket ) InitialAcquire ( serverInfo * mongoServerInfo , timeout time . Duration ) error { socket . Lock ( ) if socket . references > 0 { panic ( " " ) } if socket . dead != nil { dead := socket . dead socket . Unlock ( ) return dead } socket . references ++ socket . serverInfo = serverInfo socket . timeout = timeout stats . socketsInUse ( + 1 ) stats . socketRefs ( + 1 ) socket . Unlock ( ) return nil }
// InitialAcquire obtains the first reference to the socket, either
// right after the connection is made or once a recycled socket is
// being put back in use.
InitialAcquire obtains the first reference to the socket either right after the connection is made or once a recycled socket is being put back in use .