This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 56ec69e  Revert SHA-1: 52d263e77c48bbf7cbabd03161107557d1e410b1
56ec69e is described below

commit 56ec69e9f85d5937645e619a79eff3d4872c8f26
Author: Jens Geyer <[email protected]>
AuthorDate: Sat Mar 19 13:29:15 2022 +0100

    Revert SHA-1: 52d263e77c48bbf7cbabd03161107557d1e410b1
    
    Using sync calls breaks web scenarios.
    
    THRIFT-5499: Use blocking Read/Write calls to make sure the 
Receive/SendTimeout is checked.
    Client: netstd
---
 lib/netstd/Thrift/Transport/Client/TStreamTransport.cs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs 
b/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs
index 053a37b..90794c6 100644
--- a/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs
@@ -80,8 +80,11 @@ namespace Thrift.Transport.Client
                     "Cannot read from null inputstream");
             }
 
-            // The ReadAsync method should not be used since it does not check 
the ReceiveTimeout property.
-            return await Task.Run( () => InputStream.Read( buffer, offset, 
length ), cancellationToken );
+#if NETSTANDARD2_0
+            return await InputStream.ReadAsync(buffer, offset, length, 
cancellationToken);
+#else
+            return await InputStream.ReadAsync(new Memory<byte>(buffer, 
offset, length), cancellationToken);
+#endif
         }
 
         public override async Task WriteAsync(byte[] buffer, int offset, int 
length, CancellationToken cancellationToken)
@@ -92,8 +95,11 @@ namespace Thrift.Transport.Client
                     "Cannot write to null outputstream");
             }
 
-            // The WriteAsync method should not be used since it does not 
check the SendTimeout property.
-            await Task.Run( () => OutputStream.Write( buffer, offset, length 
), cancellationToken );
+#if NETSTANDARD2_0
+            await OutputStream.WriteAsync(buffer, offset, length, 
cancellationToken);
+#else
+            await OutputStream.WriteAsync(buffer.AsMemory(offset, length), 
cancellationToken);
+#endif
         }
 
         public override async Task FlushAsync(CancellationToken 
cancellationToken)

Reply via email to