Skip to content

Commit 3cfe101

Browse files
committed
Added use of async
1 parent 9d23395 commit 3cfe101

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/MongoDB.Driver/Core/Connections/Socks5Helper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public static async Task PerformSocks5HandshakeAsync(Stream stream, EndPoint end
134134
var greetingRequestLength = CreateGreetingRequest(buffer, useAuth);
135135
await stream.WriteAsync(buffer, 0, greetingRequestLength, cancellationToken).ConfigureAwait(false);
136136

137+
await stream.ReadBytesAsync(buffer, 0, 2, cancellationToken).ConfigureAwait(false);
137138
var acceptsUsernamePasswordAuth = ProcessGreetingResponse(buffer, useAuth);
138139

139140
if (useAuth && acceptsUsernamePasswordAuth)

src/MongoDB.Driver/Core/Connections/TcpStreamFactory.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public Stream CreateStream(EndPoint endPoint, CancellationToken cancellationToke
7272
Connect(socket, resolved[i], cancellationToken);
7373
var stream = CreateNetworkStream(socket);
7474

75-
//TODO Need to do the same for the async version and for net472
7675
if (useProxy)
7776
{
7877
Socks5Helper.PerformSocks5Handshake(stream, endPoint, socks5ProxySettings.Authentication, cancellationToken);
@@ -108,7 +107,7 @@ public async Task<Stream> CreateStreamAsync(EndPoint endPoint, CancellationToken
108107
var stream = CreateNetworkStream(socket);
109108
if (useProxy)
110109
{
111-
Socks5Helper.PerformSocks5Handshake(stream, endPoint, socks5ProxySettings.Authentication, cancellationToken);
110+
await Socks5Helper.PerformSocks5HandshakeAsync(stream, endPoint, socks5ProxySettings.Authentication, cancellationToken).ConfigureAwait(false);
112111
}
113112

114113
return stream;
@@ -124,7 +123,7 @@ public async Task<Stream> CreateStreamAsync(EndPoint endPoint, CancellationToken
124123

125124
if (useProxy)
126125
{
127-
Socks5Helper.PerformSocks5Handshake(stream, endPoint, socks5ProxySettings.Authentication, cancellationToken);
126+
await Socks5Helper.PerformSocks5HandshakeAsync(stream, endPoint, socks5ProxySettings.Authentication, cancellationToken).ConfigureAwait(false);
128127
}
129128

130129
return stream;

0 commit comments

Comments
 (0)