func (socket *mongoSocket) Release() {
	socket.Lock()
	if socket.references == 0 {
		panic("socket.Release() with references == 0")
	}
	socket.references--
	stats.socketRefs(-1)
	if socket.references == 0 {
		stats.socketsInUse(-1)
		server := socket.server
		socket.Unlock()
		socket.LogoutAll()
		// If the socket is dead server is nil.
		if server != nil {
			server.RecycleSocket(socket)
		}
	} else {
		socket.Unlock()
	}
}
func (socket *mongoSocket) Release() {
	socket.Lock()
	if socket.references == 0 {
		panic("socket.Release() with references == 0")
	}
	socket.references--
	stats.socketRefs(-1)
	if socket.references == 0 {
		stats.socketsInUse(-1)
		server := socket.server
		socket.Unlock()
		socket.LogoutAll()
		
		if server != nil {
			server.RecycleSocket(socket)
		}
	} else {
		socket.Unlock()
	}
}
func ( socket * mongoSocket ) Release ( ) { socket . Lock ( ) if socket . references == 0 { panic ( " " ) } socket . references -- stats . socketRefs ( - 1 ) if socket . references == 0 { stats . socketsInUse ( - 1 ) server := socket . server socket . Unlock ( ) socket . LogoutAll ( ) // If the socket is dead server is nil. if server != nil { server . RecycleSocket ( socket ) } } else { socket . Unlock ( ) } }
// Release decrements a socket reference. The socket will be
// recycled once its released as many times as it's been acquired.
Release decrements a socket reference . The socket will be recycled once its released as many times as it s been acquired .