Skip to content

Commit cddc2d8

Browse files
committed
Remove Poll call.
This makes "OpenFromPoolNewSync" 9x faster. If the client is disconnected, SendAsync should still throw a SocketException, allowing us to detect the failed connection.
1 parent 4f3ab3e commit cddc2d8

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/MySqlConnector/Serialization/MySqlSession.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,7 @@ public async Task<bool> TryPingAsync(IOBehavior ioBehavior, CancellationToken ca
260260
{
261261
VerifyState(State.Connected);
262262

263-
// check if client socket is still connected
264-
// http://stackoverflow.com/questions/2661764/how-to-check-if-a-socket-is-connected-disconnected-in-c
265-
if (m_socket.Poll(1, SelectMode.SelectRead) && m_socket.Available == 0)
266-
return false;
267-
// client socket is still connected, send ping payload to verify server socket is still connected
263+
// send ping payload to verify client and server socket are still connected
268264
try
269265
{
270266
await SendAsync(PingPayload.Create(), ioBehavior, cancellationToken).ConfigureAwait(false);

0 commit comments

Comments
 (0)