Fix multiple host issue at pool level

This commit is contained in:
Don Brown
2014-04-01 11:56:36 -06:00
parent 26845c7eb4
commit 9f5bdb3926
3 changed files with 26 additions and 10 deletions

View File

@@ -31,13 +31,6 @@ class Connection:
connection.host = host
# strip any additional hosts in the connection string for now
try:
if "," in port:
port = port[:port.find(',')]
except TypeError:
pass
connection.port = port
connection._loop = loop
connection._retry_interval = .5

View File

@@ -55,7 +55,19 @@ class Pool:
raise Exception("Missing database name in URI")
self._host = url.hostname
self._port = url.port or 27017
try:
port = url.port
except ValueError:
port = url._hostinfo[1]
# strip any additional hosts in the connection string for now
try:
if "," in port:
port = port[:port.find(',')]
except TypeError:
pass
self._port = port or 27017
username = url.username
password = url.password
else: