Skip to content

Commit 3221e22

Browse files
committed
Add bolt 5.1 to handshake
1 parent 1794618 commit 3221e22

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

packages/bolt-connection/src/bolt/create.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import BoltProtocolV4x2 from './bolt-protocol-v4x2'
2727
import BoltProtocolV4x3 from './bolt-protocol-v4x3'
2828
import BoltProtocolV4x4 from './bolt-protocol-v4x4'
2929
import BoltProtocolV5x0 from './bolt-protocol-v5x0'
30+
import BoltProtocolV5x1 from './bolt-protocol-v5x1'
3031
// eslint-disable-next-line no-unused-vars
3132
import { Chunker, Dechunker } from '../channel'
3233
import ResponseHandler from './response-handler'
@@ -191,6 +192,16 @@ function createProtocol (
191192
onProtocolError,
192193
serversideRouting
193194
)
195+
case 5.1:
196+
return new BoltProtocolV5x1(
197+
server,
198+
chunker,
199+
packingConfig,
200+
createResponseHandler,
201+
log,
202+
onProtocolError,
203+
serversideRouting
204+
)
194205
default:
195206
throw newError('Unknown Bolt protocol version: ' + version)
196207
}

packages/bolt-connection/src/bolt/handshake.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function parseNegotiatedResponse (buffer) {
7676
*/
7777
function newHandshakeBuffer () {
7878
return createHandshakeMessage([
79-
version(5, 0),
79+
[version(5, 1), version(5, 0)],
8080
[version(4, 4), version(4, 2)],
8181
version(4, 1),
8282
version(3, 0)

packages/bolt-connection/test/bolt/index.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import BoltProtocolV4x2 from '../../src/bolt/bolt-protocol-v4x2'
3131
import BoltProtocolV4x3 from '../../src/bolt/bolt-protocol-v4x3'
3232
import BoltProtocolV4x4 from '../../src/bolt/bolt-protocol-v4x4'
3333
import BoltProtocolV5x0 from '../../src/bolt/bolt-protocol-v5x0'
34+
import BoltProtocolV5x1 from '../../src/bolt/bolt-protocol-v5x1'
3435

3536
const {
3637
logger: { Logger }
@@ -44,13 +45,13 @@ describe('#unit Bolt', () => {
4445
const writtenBuffer = channel.written[0]
4546

4647
const boltMagicPreamble = '60 60 b0 17'
47-
const protocolVersion5x0 = '00 00 00 05'
48+
const protocolVersion5x1to5x0 = '00 01 01 05'
4849
const protocolVersion4x4to4x2 = '00 02 04 04'
4950
const protocolVersion4x1 = '00 00 01 04'
5051
const protocolVersion3 = '00 00 00 03'
5152

5253
expect(writtenBuffer.toHex()).toEqual(
53-
`${boltMagicPreamble} ${protocolVersion5x0} ${protocolVersion4x4to4x2} ${protocolVersion4x1} ${protocolVersion3}`
54+
`${boltMagicPreamble} ${protocolVersion5x1to5x0} ${protocolVersion4x4to4x2} ${protocolVersion4x1} ${protocolVersion3}`
5455
)
5556
})
5657

@@ -359,7 +360,8 @@ describe('#unit Bolt', () => {
359360
v(4.2, BoltProtocolV4x2),
360361
v(4.3, BoltProtocolV4x3),
361362
v(4.4, BoltProtocolV4x4),
362-
v(5.0, BoltProtocolV5x0)
363+
v(5.0, BoltProtocolV5x0),
364+
v(5.1, BoltProtocolV5x1)
363365
]
364366

365367
availableProtocols.forEach(lambda)

packages/neo4j-driver-deno/lib/bolt-connection/bolt/create.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import BoltProtocolV4x2 from './bolt-protocol-v4x2.js'
2727
import BoltProtocolV4x3 from './bolt-protocol-v4x3.js'
2828
import BoltProtocolV4x4 from './bolt-protocol-v4x4.js'
2929
import BoltProtocolV5x0 from './bolt-protocol-v5x0.js'
30+
import BoltProtocolV5x1 from './bolt-protocol-v5x1.js'
3031
// eslint-disable-next-line no-unused-vars
3132
import { Chunker, Dechunker } from '../channel/index.js'
3233
import ResponseHandler from './response-handler.js'
@@ -191,6 +192,16 @@ function createProtocol (
191192
onProtocolError,
192193
serversideRouting
193194
)
195+
case 5.1:
196+
return new BoltProtocolV5x1(
197+
server,
198+
chunker,
199+
packingConfig,
200+
createResponseHandler,
201+
log,
202+
onProtocolError,
203+
serversideRouting
204+
)
194205
default:
195206
throw newError('Unknown Bolt protocol version: ' + version)
196207
}

packages/neo4j-driver-deno/lib/bolt-connection/bolt/handshake.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function parseNegotiatedResponse (buffer) {
7676
*/
7777
function newHandshakeBuffer () {
7878
return createHandshakeMessage([
79-
version(5, 0),
79+
[version(5, 1), version(5, 0)],
8080
[version(4, 4), version(4, 2)],
8181
version(4, 1),
8282
version(3, 0)

0 commit comments

Comments
 (0)