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 {
254254
255255 if ( lowerVersion === self . protocolVersion ) {
256256 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` ) ;
259263 lowerVersion = types . protocolVersion . getLowerSupported ( self . protocol . version ) ;
260264 }
261265
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ const protocolVersion = {
4949 v3 : 0x03 ,
5050 v4 : 0x04 ,
5151 v5 : 0x05 ,
52+ v6 : 0x06 ,
5253 dseV1 : 0x41 ,
5354 dseV2 : 0x42 ,
5455 maxSupported : 0x42 ,
@@ -64,14 +65,25 @@ const protocolVersion = {
6465 return ( ( version >= this . dseV1 && version <= this . dseV2 ) ) ;
6566 } ,
6667 /**
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.
6879 * @param {Number } version
6980 * @returns {Boolean }
7081 * @ignore
7182 */
7283 isSupported : function ( version ) {
73- return ( this . isDse ( version ) || ( version <= 0x04 && version >= 0x01 ) ) ;
84+ return ( this . isDse ( version ) || this . isSupportedCassandra ( version ) ) ;
7485 } ,
86+
7587 /**
7688 * Determines whether the protocol includes flags for PREPARE messages.
7789 * @param {Number } version
You can’t perform that action at this time.
0 commit comments