@@ -60,6 +60,7 @@ public ServerSession(ConnectionPool pool, int poolGeneration, int id)
60
60
public IPAddress IPAddress => ( m_tcpClient ? . Client . RemoteEndPoint as IPEndPoint ) ? . Address ;
61
61
public WeakReference < MySqlConnection > OwningConnection { get ; set ; }
62
62
public bool SupportsDeprecateEof => m_supportsDeprecateEof ;
63
+ public bool SupportsSessionTrack => m_supportsSessionTrack ;
63
64
public bool ProcAccessDenied { get ; set ; }
64
65
65
66
public void ReturnToPool ( )
@@ -186,7 +187,7 @@ public void FinishQuerying()
186
187
var payload = QueryPayload . Create ( "DO SLEEP(0);" ) ;
187
188
SendAsync ( payload , IOBehavior . Synchronous , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
188
189
payload = ReceiveReplyAsync ( IOBehavior . Synchronous , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
189
- OkPayload . Create ( payload . AsSpan ( ) ) ;
190
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
190
191
}
191
192
192
193
lock ( m_lock )
@@ -310,12 +311,13 @@ public async Task ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer
310
311
311
312
m_supportsConnectionAttributes = ( initialHandshake . ProtocolCapabilities & ProtocolCapabilities . ConnectionAttributes ) != 0 ;
312
313
m_supportsDeprecateEof = ( initialHandshake . ProtocolCapabilities & ProtocolCapabilities . DeprecateEof ) != 0 ;
314
+ m_supportsSessionTrack = ( initialHandshake . ProtocolCapabilities & ProtocolCapabilities . SessionTrack ) != 0 ;
313
315
var serverSupportsSsl = ( initialHandshake . ProtocolCapabilities & ProtocolCapabilities . Ssl ) != 0 ;
314
316
m_characterSet = ServerVersion . Version >= ServerVersions . SupportsUtf8Mb4 ? CharacterSet . Utf8Mb4GeneralCaseInsensitive : CharacterSet . Utf8GeneralCaseInsensitive ;
315
317
316
- Log . Info ( "Session{0} made connection; ServerVersion={1}; ConnectionId={2}; Compression={3}; Attributes={4}; DeprecateEof={5}; Ssl={6}" ,
318
+ Log . Info ( "Session{0} made connection; ServerVersion={1}; ConnectionId={2}; Compression={3}; Attributes={4}; DeprecateEof={5}; Ssl={6}; SessionTrack={7} " ,
317
319
m_logArguments [ 0 ] , ServerVersion . OriginalString , ConnectionId ,
318
- m_useCompression , m_supportsConnectionAttributes , m_supportsDeprecateEof , serverSupportsSsl ) ;
320
+ m_useCompression , m_supportsConnectionAttributes , m_supportsDeprecateEof , serverSupportsSsl , m_supportsSessionTrack ) ;
319
321
320
322
if ( cs . SslMode != MySqlSslMode . None && ( cs . SslMode != MySqlSslMode . Preferred || serverSupportsSsl ) )
321
323
{
@@ -363,7 +365,7 @@ public async Task ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer
363
365
payload = await SwitchAuthenticationAsync ( cs , payload , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
364
366
}
365
367
366
- OkPayload . Create ( payload . AsSpan ( ) ) ;
368
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
367
369
368
370
if ( m_useCompression )
369
371
m_payloadHandler = new CompressedPayloadHandler ( m_payloadHandler . ByteHandler ) ;
@@ -398,12 +400,12 @@ public async Task<bool> TryResetConnectionAsync(ConnectionSettings cs, IOBehavio
398
400
Log . Debug ( "Session{0} ServerVersion={1} supports reset connection; sending reset connection request" , m_logArguments ) ;
399
401
await SendAsync ( ResetConnectionPayload . Instance , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
400
402
var payload = await ReceiveReplyAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
401
- OkPayload . Create ( payload . AsSpan ( ) ) ;
403
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
402
404
403
405
// the "reset connection" packet also resets the connection charset, so we need to change that back to our default
404
406
await SendAsync ( s_setNamesUtf8mb4Payload , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
405
407
payload = await ReceiveReplyAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
406
- OkPayload . Create ( payload . AsSpan ( ) ) ;
408
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
407
409
}
408
410
else
409
411
{
@@ -428,7 +430,7 @@ public async Task<bool> TryResetConnectionAsync(ConnectionSettings cs, IOBehavio
428
430
Log . Debug ( "Session{0} optimistic reauthentication failed; logging in again" , m_logArguments ) ;
429
431
payload = await SwitchAuthenticationAsync ( cs , payload , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
430
432
}
431
- OkPayload . Create ( payload . AsSpan ( ) ) ;
433
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
432
434
}
433
435
434
436
return true ;
@@ -609,7 +611,7 @@ public async ValueTask<bool> TryPingAsync(IOBehavior ioBehavior, CancellationTok
609
611
Log . Debug ( "Session{0} pinging server" , m_logArguments ) ;
610
612
await SendAsync ( PingPayload . Instance , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
611
613
var payload = await ReceiveReplyAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
612
- OkPayload . Create ( payload . AsSpan ( ) ) ;
614
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
613
615
Log . Info ( "Session{0} successfully pinged server" , m_logArguments ) ;
614
616
return true ;
615
617
}
@@ -1163,7 +1165,7 @@ void ReadRow(ReadOnlySpan<byte> span, out int? connectionId_, out string serverV
1163
1165
// OK/EOF payload
1164
1166
payload = await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
1165
1167
if ( OkPayload . IsOk ( payload . AsSpan ( ) , SupportsDeprecateEof ) )
1166
- OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof ) ;
1168
+ OkPayload . Create ( payload . AsSpan ( ) , SupportsDeprecateEof , SupportsSessionTrack ) ;
1167
1169
else
1168
1170
EofPayload . Create ( payload . AsSpan ( ) ) ;
1169
1171
@@ -1410,6 +1412,7 @@ private enum State
1410
1412
bool m_isSecureConnection ;
1411
1413
bool m_supportsConnectionAttributes ;
1412
1414
bool m_supportsDeprecateEof ;
1415
+ bool m_supportsSessionTrack ;
1413
1416
CharacterSet m_characterSet ;
1414
1417
Dictionary < string , PreparedStatements > m_preparedStatements ;
1415
1418
}
0 commit comments