You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/05/27 09:30:32 UTC

[1/2] thrift git commit: THRIFT-4209 warning CS0414 in T[TLS]ServerSocket.cs Client: C# Patch: Jens Geyer

Repository: thrift
Updated Branches:
  refs/heads/master e41e47c2b -> 5608e43ec


THRIFT-4209 warning CS0414 in T[TLS]ServerSocket.cs
Client: C#
Patch: Jens Geyer


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/888b577e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/888b577e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/888b577e

Branch: refs/heads/master
Commit: 888b577ea678df7b486843b86a18cebd93002ba8
Parents: e41e47c
Author: Jens Geyer <je...@apache.org>
Authored: Wed May 24 21:32:28 2017 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Sat May 27 11:26:19 2017 +0200

----------------------------------------------------------------------
 lib/csharp/src/Transport/TServerSocket.cs    | 4 ++--
 lib/csharp/src/Transport/TTLSServerSocket.cs | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/888b577e/lib/csharp/src/Transport/TServerSocket.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TServerSocket.cs b/lib/csharp/src/Transport/TServerSocket.cs
index 453df34..e29a87e 100644
--- a/lib/csharp/src/Transport/TServerSocket.cs
+++ b/lib/csharp/src/Transport/TServerSocket.cs
@@ -90,13 +90,13 @@ namespace Thrift.Transport
 			try
 			{
 				// Make server socket
-				this.server = TSocketVersionizer.CreateTcpListener(port);
+				this.server = TSocketVersionizer.CreateTcpListener(this.port);
 				this.server.Server.NoDelay = true;
 			}
 			catch (Exception)
 			{
 				server = null;
-				throw new TTransportException("Could not create ServerSocket on port " + port + ".");
+				throw new TTransportException("Could not create ServerSocket on port " + this.port + ".");
 			}
 		}
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/888b577e/lib/csharp/src/Transport/TTLSServerSocket.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TTLSServerSocket.cs b/lib/csharp/src/Transport/TTLSServerSocket.cs
index d51c217..24222b7 100644
--- a/lib/csharp/src/Transport/TTLSServerSocket.cs
+++ b/lib/csharp/src/Transport/TTLSServerSocket.cs
@@ -126,13 +126,13 @@ namespace Thrift.Transport
             try
             {
                 // Create server socket
-                this.server = TSocketVersionizer.CreateTcpListener(port);
+                this.server = TSocketVersionizer.CreateTcpListener(this.port);
                 this.server.Server.NoDelay = true;
             }
             catch (Exception)
             {
                 server = null;
-                throw new TTransportException("Could not create ServerSocket on port " + port + ".");
+                throw new TTransportException("Could not create ServerSocket on port " + this.port + ".");
             }
         }
 


[2/2] thrift git commit: THRIFT-4208 C# NamedPipesServer not really working in some scenarios Client: C# Patch: Jens Geyer

Posted by je...@apache.org.
THRIFT-4208 C# NamedPipesServer not really working in some scenarios Client: C# Patch: Jens Geyer


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/5608e43e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/5608e43e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/5608e43e

Branch: refs/heads/master
Commit: 5608e43ec8c1fb77460c7ab3b27bbda251d29be9
Parents: 888b577
Author: Jens Geyer <je...@apache.org>
Authored: Wed May 24 15:27:02 2017 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Sat May 27 11:26:20 2017 +0200

----------------------------------------------------------------------
 .../src/Transport/TNamedPipeServerTransport.cs  | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/5608e43e/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TNamedPipeServerTransport.cs b/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
index c1e8400..240f0df 100644
--- a/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
+++ b/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
@@ -22,9 +22,9 @@
  */
 
 using System;
-using System.Collections.Generic;
 using System.IO.Pipes;
 using System.Threading;
+using System.Security.Principal;
 
 namespace Thrift.Transport
 {
@@ -68,23 +68,32 @@ namespace Thrift.Transport
             if (stream == null)
             {
                 var direction = PipeDirection.InOut;
-                var maxconn = 254;
+                var maxconn = NamedPipeServerStream.MaxAllowedServerInstances;
                 var mode = PipeTransmissionMode.Byte;
                 var options = asyncMode ? PipeOptions.Asynchronous : PipeOptions.None;
-                var inbuf = 4096;
-                var outbuf = 4096;
-                // TODO: security
+                const int INBUF_SIZE = 4096;
+                const int OUTBUF_SIZE = 4096;
+
+                // security
+                var security = new PipeSecurity();
+                security.AddAccessRule(
+                    new PipeAccessRule(
+                        new SecurityIdentifier(WellKnownSidType.WorldSid, null),
+                        PipeAccessRights.Read | PipeAccessRights.Write | PipeAccessRights.Synchronize | PipeAccessRights.CreateNewInstance,
+                        System.Security.AccessControl.AccessControlType.Allow
+                    )
+                );
 
                 try
                 {
-                    stream = new NamedPipeServerStream(pipeAddress, direction, maxconn, mode, options, inbuf, outbuf);
+                    stream = new NamedPipeServerStream(pipeAddress, direction, maxconn, mode, options, INBUF_SIZE, OUTBUF_SIZE, security);
                 }
                 catch (NotImplementedException)  // Mono still does not support async, fallback to sync
                 {
                     if (asyncMode)
                     {
                         options &= (~PipeOptions.Asynchronous);
-                        stream = new NamedPipeServerStream(pipeAddress, direction, maxconn, mode, options, inbuf, outbuf);
+                        stream = new NamedPipeServerStream(pipeAddress, direction, maxconn, mode, options, INBUF_SIZE, OUTBUF_SIZE, security);
                         asyncMode = false;
                     }
                     else