@@ -182,20 +182,21 @@ def protocol_handlers(cls, protocol_version=None):
182
182
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
183
183
from ._bolt3 import AsyncBolt3
184
184
from ._bolt4 import (
185
- AsyncBolt4x0 ,
186
185
AsyncBolt4x1 ,
187
186
AsyncBolt4x2 ,
188
187
AsyncBolt4x3 ,
189
188
AsyncBolt4x4 ,
190
189
)
190
+ from ._bolt5 import AsyncBolt5x0
191
191
192
192
handlers = {
193
193
AsyncBolt3 .PROTOCOL_VERSION : AsyncBolt3 ,
194
- AsyncBolt4x0 . PROTOCOL_VERSION : AsyncBolt4x0 ,
194
+ # 4.0 unsupported because no space left in the handshake
195
195
AsyncBolt4x1 .PROTOCOL_VERSION : AsyncBolt4x1 ,
196
196
AsyncBolt4x2 .PROTOCOL_VERSION : AsyncBolt4x2 ,
197
197
AsyncBolt4x3 .PROTOCOL_VERSION : AsyncBolt4x3 ,
198
198
AsyncBolt4x4 .PROTOCOL_VERSION : AsyncBolt4x4 ,
199
+ AsyncBolt5x0 .PROTOCOL_VERSION : AsyncBolt5x0 ,
199
200
}
200
201
201
202
if protocol_version is None :
@@ -215,9 +216,9 @@ def version_list(cls, versions, limit=4):
215
216
preference. The number of protocol versions (or ranges)
216
217
returned is limited to four.
217
218
"""
218
- # In fact, 4.3 is the fist version to support ranges. However, the range
219
- # support got backported to 4.2. But even if the server is too old to
220
- # have the backport, negotiating BOLT 4.1 is no problem as it's
219
+ # In fact, 4.3 is the fist version to support ranges. However, the
220
+ # range support got backported to 4.2. But even if the server is too
221
+ # old to have the backport, negotiating BOLT 4.1 is no problem as it's
221
222
# equivalent to 4.2
222
223
first_with_range_support = Version (4 , 2 )
223
224
result = []
@@ -313,9 +314,12 @@ def time_remaining():
313
314
if pool_config .protocol_version == (3 , 0 ):
314
315
from ._bolt3 import AsyncBolt3
315
316
bolt_cls = AsyncBolt3
316
- elif pool_config .protocol_version == (4 , 0 ):
317
- from ._bolt4 import AsyncBolt4x0
318
- bolt_cls = AsyncBolt4x0
317
+ # Implementation for 4.0 exists, but there was no space left in the
318
+ # handshake to offer this version to the server. Hence, the server
319
+ # should never request us to speak bolt 4.0.
320
+ # elif pool_config.protocol_version == (4, 0):
321
+ # from ._bolt4 import AsyncBolt4x0
322
+ # bolt_cls = AsyncBolt4x0
319
323
elif pool_config .protocol_version == (4 , 1 ):
320
324
from ._bolt4 import AsyncBolt4x1
321
325
bolt_cls = AsyncBolt4x1
@@ -328,15 +332,18 @@ def time_remaining():
328
332
elif pool_config .protocol_version == (4 , 4 ):
329
333
from ._bolt4 import AsyncBolt4x4
330
334
bolt_cls = AsyncBolt4x4
335
+ elif pool_config .protocol_version == (5 , 0 ):
336
+ from ._bolt5 import AsyncBolt5x0
337
+ bolt_cls = AsyncBolt5x0
331
338
else :
332
339
log .debug ("[#%04X] S: <CLOSE>" , s .getsockname ()[1 ])
333
340
AsyncBoltSocket .close_socket (s )
334
341
335
342
supported_versions = cls .protocol_handlers ().keys ()
336
343
raise BoltHandshakeError (
337
344
"The Neo4J server does not support communication with this "
338
- "driver. This driver have support for Bolt Protocols {} "
339
- "" .format (supported_versions ),
345
+ "driver. This driver has support for Bolt protocols "
346
+ "{} " .format (tuple ( map ( str , supported_versions )) ),
340
347
address = address , request_data = handshake , response_data = data
341
348
)
342
349
@@ -670,13 +677,11 @@ async def close_non_blocking(self):
670
677
self .socket .settimeout (0 )
671
678
await self .close ()
672
679
673
- @abc .abstractmethod
674
680
def closed (self ):
675
- pass
681
+ return self . _closed
676
682
677
- @abc .abstractmethod
678
683
def defunct (self ):
679
- pass
684
+ return self . _defunct
680
685
681
686
def is_idle_for (self , timeout ):
682
687
"""Check if connection has been idle for at least the given timeout.
0 commit comments