@@ -335,7 +335,9 @@ await gzStream.WriteAsync(packageBuffer.Array, packageBuffer.Offset + PACKAGE_TO
335335
336336 //发送包内容
337337 var writeTask = stream . WriteAsync ( packageBuffer . Array , packageBuffer . Offset , packageBuffer . Count ) ;
338- await await TaskUtils . TaskWait ( writeTask , options . InternalTransportTimeout ) . ConfigureAwait ( false ) ;
338+ await writeTask
339+ . WaitAsync ( TimeSpan . FromMilliseconds ( options . InternalTransportTimeout ) )
340+ . ConfigureAwait ( false ) ;
339341
340342 if ( writeTask . IsCanceled )
341343 return ;
@@ -645,7 +647,10 @@ private async Task<int> readData(Stream stream, byte[] buffer, int startIndex, i
645647 if ( cancellationToken . IsCancellationRequested )
646648 break ;
647649 var readTask = stream . ReadAsync ( buffer , count + startIndex , totalCount - count , cancellationToken ) ;
648- ret = await await TaskUtils . TaskWait ( readTask , options . InternalTransportTimeout ) . ConfigureAwait ( false ) ;
650+ ret = await readTask
651+ . WaitAsync ( TimeSpan . FromMilliseconds ( options . InternalTransportTimeout ) )
652+ . ConfigureAwait ( false ) ;
653+
649654 if ( readTask . IsCanceled || ret == 0 )
650655 break ;
651656 if ( ret < 0 )
@@ -1127,7 +1132,9 @@ public async Task<CommandResponseTypeNameAndContent> SendCommand(string requestT
11271132 {
11281133 try
11291134 {
1130- await TaskUtils . TaskWait ( Task . Run ( ( ) => SendCommandRequestPackage ( commandContext . Id , requestTypeName , requestContent , afterSendHandler ) ) , timeout ) . ConfigureAwait ( false ) ;
1135+ await Task . Run ( ( ) => SendCommandRequestPackage ( commandContext . Id , requestTypeName , requestContent , afterSendHandler ) )
1136+ . WaitAsync ( TimeSpan . FromMilliseconds ( timeout ) )
1137+ . ConfigureAwait ( false ) ;
11311138 }
11321139 catch
11331140 {
@@ -1140,7 +1147,9 @@ public async Task<CommandResponseTypeNameAndContent> SendCommand(string requestT
11401147 commandDict . TryRemove ( commandContext . Id , out _ ) ;
11411148 }
11421149 }
1143- return await await TaskUtils . TaskWait ( commandContext . ResponseTask , timeout ) . ConfigureAwait ( false ) ;
1150+ return await commandContext . ResponseTask
1151+ . WaitAsync ( TimeSpan . FromMilliseconds ( timeout ) )
1152+ . ConfigureAwait ( false ) ;
11441153 }
11451154 }
11461155
@@ -1164,7 +1173,9 @@ public async Task<TCmdResponse> SendCommand<TCmdResponse>(IQpCommandRequest<TCmd
11641173 {
11651174 try
11661175 {
1167- await TaskUtils . TaskWait ( Task . Run ( ( ) => SendCommandRequestPackage ( commandContext . Id , typeName , requestContent , afterSendHandler ) ) , timeout ) . ConfigureAwait ( false ) ;
1176+ await Task . Run ( ( ) => SendCommandRequestPackage ( commandContext . Id , typeName , requestContent , afterSendHandler ) )
1177+ . WaitAsync ( TimeSpan . FromMilliseconds ( timeout ) )
1178+ . ConfigureAwait ( false ) ;
11681179 }
11691180 catch
11701181 {
@@ -1177,7 +1188,9 @@ public async Task<TCmdResponse> SendCommand<TCmdResponse>(IQpCommandRequest<TCmd
11771188 commandDict . TryRemove ( commandContext . Id , out _ ) ;
11781189 }
11791190 }
1180- ret = await await TaskUtils . TaskWait ( commandContext . ResponseTask , timeout ) . ConfigureAwait ( false ) ;
1191+ ret = await commandContext . ResponseTask
1192+ . WaitAsync ( TimeSpan . FromMilliseconds ( timeout ) )
1193+ . ConfigureAwait ( false ) ;
11811194 }
11821195 return JsonConvert . DeserializeObject < TCmdResponse > ( ret . Content ) ;
11831196 }
0 commit comments