File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -254,8 +254,12 @@ class Connection extends events.EventEmitter {
254
254
255
255
if ( lowerVersion === self . protocolVersion ) {
256
256
lowerVersion = types . protocolVersion . getLowerSupported ( self . protocolVersion ) ;
257
- } else if ( types . protocolVersion . isBeta ( self . protocol . version ) ) {
258
- // Avoid downgrading the protocol version to a BETA protocol
257
+ } else if ( ! types . protocolVersion . isSupported ( self . protocol . version ) ) {
258
+ // If we have an unsupported protocol version or a beta version we need to switch
259
+ // to something we can support. Note that dseV1 and dseV2 are excluded from this
260
+ // logic as they are supported. Also note that any v5 and greater beta protocols
261
+ // are included here since the beta flag was introduced in v5.
262
+ self . log ( 'info' , `Protocol version ${ self . protocol . version } not supported by this driver, downgrading` ) ;
259
263
lowerVersion = types . protocolVersion . getLowerSupported ( self . protocol . version ) ;
260
264
}
261
265
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ const protocolVersion = {
49
49
v3 : 0x03 ,
50
50
v4 : 0x04 ,
51
51
v5 : 0x05 ,
52
+ v6 : 0x06 ,
52
53
dseV1 : 0x41 ,
53
54
dseV2 : 0x42 ,
54
55
maxSupported : 0x42 ,
@@ -64,14 +65,25 @@ const protocolVersion = {
64
65
return ( ( version >= this . dseV1 && version <= this . dseV2 ) ) ;
65
66
} ,
66
67
/**
67
- * Determines whether the protocol protocol version is supported by this driver.
68
+ * Returns true if the protocol version represents a version of Cassandra
69
+ * supported by this driver, false otherwise
70
+ * @param {Number } version
71
+ * @returns {Boolean }
72
+ * @ignore
73
+ */
74
+ isSupportedCassandra : function ( version ) {
75
+ return ( version <= 0x04 && version >= 0x01 ) ;
76
+ } ,
77
+ /**
78
+ * Determines whether the protocol version is supported by this driver.
68
79
* @param {Number } version
69
80
* @returns {Boolean }
70
81
* @ignore
71
82
*/
72
83
isSupported : function ( version ) {
73
- return ( this . isDse ( version ) || ( version <= 0x04 && version >= 0x01 ) ) ;
84
+ return ( this . isDse ( version ) || this . isSupportedCassandra ( version ) ) ;
74
85
} ,
86
+
75
87
/**
76
88
* Determines whether the protocol includes flags for PREPARE messages.
77
89
* @param {Number } version
You can’t perform that action at this time.
0 commit comments