@@ -214,7 +214,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
214
214
var result = new PooledSocketResult ( ) ;
215
215
if ( ! _isInitialized )
216
216
{
217
- if ( ! await poolInitSemaphore . WaitAsync ( _initPoolTimeout ) )
217
+ if ( ! await poolInitSemaphore . WaitAsync ( _initPoolTimeout ) . ConfigureAwait ( false ) )
218
218
{
219
219
return result . Fail ( "Timeout to poolInitSemaphore.Wait" , _logger ) as PooledSocketResult ;
220
220
}
@@ -224,7 +224,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
224
224
if ( ! _isInitialized )
225
225
{
226
226
var startTime = DateTime . Now ;
227
- await _internalPoolImpl . InitPoolAsync ( ) ;
227
+ await _internalPoolImpl . InitPoolAsync ( ) . ConfigureAwait ( false ) ;
228
228
_isInitialized = true ;
229
229
230
230
if ( _logger . IsEnabled ( LogLevel . Information ) )
@@ -242,7 +242,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
242
242
243
243
try
244
244
{
245
- return await _internalPoolImpl . AcquireAsync ( ) ;
245
+ return await _internalPoolImpl . AcquireAsync ( ) . ConfigureAwait ( false ) ;
246
246
}
247
247
catch ( Exception e )
248
248
{
@@ -397,7 +397,7 @@ internal async Task InitPoolAsync()
397
397
{
398
398
try
399
399
{
400
- _freeItems . Push ( await CreateSocketAsync ( ) ) ;
400
+ _freeItems . Push ( await CreateSocketAsync ( ) . ConfigureAwait ( false ) ) ;
401
401
}
402
402
catch ( Exception ex )
403
403
{
@@ -423,7 +423,7 @@ internal async Task InitPoolAsync()
423
423
424
424
private async Task < PooledSocket > CreateSocketAsync ( )
425
425
{
426
- var ps = await _ownerNode . CreateSocketAsync ( ) ;
426
+ var ps = await _ownerNode . CreateSocketAsync ( ) . ConfigureAwait ( false ) ;
427
427
ps . CleanupCallback = ReleaseSocket ;
428
428
429
429
return ps ;
@@ -586,7 +586,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
586
586
587
587
PooledSocket socket = null ;
588
588
589
- if ( ! await _semaphore . WaitAsync ( _queueTimeout ) )
589
+ if ( ! await _semaphore . WaitAsync ( _queueTimeout ) . ConfigureAwait ( false ) )
590
590
{
591
591
message = "Pool is full, timeouting. " + _endPoint ;
592
592
if ( _isDebugEnabled ) _logger . LogDebug ( message ) ;
@@ -616,9 +616,9 @@ public async Task<IPooledSocketResult> AcquireAsync()
616
616
{
617
617
var resetTask = socket . ResetAsync ( ) ;
618
618
619
- if ( await Task . WhenAny ( resetTask , Task . Delay ( _receiveTimeout ) ) == resetTask )
619
+ if ( await Task . WhenAny ( resetTask , Task . Delay ( _receiveTimeout ) ) . ConfigureAwait ( false ) == resetTask )
620
620
{
621
- await resetTask ;
621
+ await resetTask . ConfigureAwait ( false ) ;
622
622
}
623
623
else
624
624
{
@@ -662,7 +662,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
662
662
{
663
663
// okay, create the new item
664
664
var startTime = DateTime . Now ;
665
- socket = await CreateSocketAsync ( ) ;
665
+ socket = await CreateSocketAsync ( ) . ConfigureAwait ( false ) ;
666
666
667
667
if ( _logger . IsEnabled ( LogLevel . Information ) )
668
668
{
@@ -927,13 +927,13 @@ protected internal virtual async Task<PooledSocket> CreateSocketAsync()
927
927
{
928
928
try
929
929
{
930
- return await CreateSocketInternalAsync ( ) ;
930
+ return await CreateSocketInternalAsync ( ) . ConfigureAwait ( false ) ;
931
931
}
932
932
catch
933
933
{
934
934
try
935
935
{
936
- return await CreateSocketInternalAsync ( ) ;
936
+ return await CreateSocketInternalAsync ( ) . ConfigureAwait ( false ) ;
937
937
}
938
938
catch ( Exception ex )
939
939
{
@@ -951,7 +951,7 @@ private async Task<PooledSocket> CreateSocketInternalAsync()
951
951
#else
952
952
_useSslStream , _useIPv6 ) ;
953
953
#endif
954
- await ps . ConnectAsync ( ) ;
954
+ await ps . ConnectAsync ( ) . ConfigureAwait ( false ) ;
955
955
return ps ;
956
956
}
957
957
@@ -1018,7 +1018,7 @@ protected virtual async Task<IPooledSocketResult> ExecuteOperationAsync(IOperati
1018
1018
_logger . LogDebug ( $ "ExecuteOperationAsync({ op } )") ;
1019
1019
}
1020
1020
1021
- var result = await AcquireAsync ( ) ;
1021
+ var result = await AcquireAsync ( ) . ConfigureAwait ( false ) ;
1022
1022
if ( result . Success && result . HasValue )
1023
1023
{
1024
1024
try
@@ -1034,13 +1034,13 @@ protected virtual async Task<IPooledSocketResult> ExecuteOperationAsync(IOperati
1034
1034
}
1035
1035
1036
1036
var writeSocketTask = pooledSocket . WriteAsync ( b ) ;
1037
- if ( await Task . WhenAny ( writeSocketTask , Task . Delay ( _config . ConnectionTimeout ) ) != writeSocketTask )
1037
+ if ( await Task . WhenAny ( writeSocketTask , Task . Delay ( _config . ConnectionTimeout ) ) . ConfigureAwait ( false ) != writeSocketTask )
1038
1038
{
1039
1039
result . Fail ( "Timeout to pooledSocket.WriteAsync" ) ;
1040
1040
return result ;
1041
1041
}
1042
1042
1043
- await writeSocketTask ;
1043
+ await writeSocketTask . ConfigureAwait ( false ) ;
1044
1044
1045
1045
//if Get, call BinaryResponse
1046
1046
if ( _logger . IsEnabled ( LogLevel . Debug ) )
@@ -1049,13 +1049,13 @@ protected virtual async Task<IPooledSocketResult> ExecuteOperationAsync(IOperati
1049
1049
}
1050
1050
1051
1051
var readResponseTask = op . ReadResponseAsync ( pooledSocket ) ;
1052
- if ( await Task . WhenAny ( readResponseTask , Task . Delay ( _config . ConnectionTimeout ) ) != readResponseTask )
1052
+ if ( await Task . WhenAny ( readResponseTask , Task . Delay ( _config . ConnectionTimeout ) ) . ConfigureAwait ( false ) != readResponseTask )
1053
1053
{
1054
1054
result . Fail ( $ "Timeout to ReadResponseAsync(pooledSocket) for { op } ") ;
1055
1055
return result ;
1056
1056
}
1057
1057
1058
- var readResult = await readResponseTask ;
1058
+ var readResult = await readResponseTask . ConfigureAwait ( false ) ;
1059
1059
if ( readResult . Success )
1060
1060
{
1061
1061
result . Pass ( ) ;
@@ -1103,22 +1103,22 @@ protected virtual async Task<IPooledSocketResult> ExecuteOperationAsync(IOperati
1103
1103
1104
1104
protected virtual async Task < bool > ExecuteOperationAsync ( IOperation op , Action < bool > next )
1105
1105
{
1106
- var socket = ( await AcquireAsync ( ) ) . Value ;
1106
+ var socket = ( await AcquireAsync ( ) . ConfigureAwait ( false ) ) . Value ;
1107
1107
if ( socket == null ) return false ;
1108
1108
1109
1109
//key(string) to buffer(btye[])
1110
1110
var b = op . GetBuffer ( ) ;
1111
1111
1112
1112
try
1113
1113
{
1114
- await socket . WriteAsync ( b ) ;
1114
+ await socket . WriteAsync ( b ) . ConfigureAwait ( false ) ;
1115
1115
1116
1116
var rrs = await op . ReadResponseAsync ( socket , readSuccess =>
1117
1117
{
1118
1118
( ( IDisposable ) socket ) . Dispose ( ) ;
1119
1119
1120
1120
next ( readSuccess ) ;
1121
- } ) ;
1121
+ } ) . ConfigureAwait ( false ) ;
1122
1122
1123
1123
return rrs ;
1124
1124
}
@@ -1164,12 +1164,12 @@ IOperationResult IMemcachedNode.Execute(IOperation op)
1164
1164
1165
1165
async Task < IOperationResult > IMemcachedNode . ExecuteAsync ( IOperation op )
1166
1166
{
1167
- return await ExecuteOperationAsync ( op ) ;
1167
+ return await ExecuteOperationAsync ( op ) . ConfigureAwait ( false ) ;
1168
1168
}
1169
1169
1170
1170
async Task < bool > IMemcachedNode . ExecuteAsync ( IOperation op , Action < bool > next )
1171
1171
{
1172
- return await ExecuteOperationAsync ( op , next ) ;
1172
+ return await ExecuteOperationAsync ( op , next ) . ConfigureAwait ( false ) ;
1173
1173
}
1174
1174
1175
1175
event Action < IMemcachedNode > IMemcachedNode . Failed
0 commit comments