|
|
@ -48,6 +48,7 @@ namespace Grpc.Core |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public class Server |
|
|
|
public class Server |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
const int InitialAllowRpcTokenCount = 10; |
|
|
|
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<Server>(); |
|
|
|
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<Server>(); |
|
|
|
|
|
|
|
|
|
|
|
readonly AtomicCounter activeCallCounter = new AtomicCounter(); |
|
|
|
readonly AtomicCounter activeCallCounter = new AtomicCounter(); |
|
|
@ -129,9 +130,15 @@ namespace Grpc.Core |
|
|
|
startRequested = true; |
|
|
|
startRequested = true; |
|
|
|
|
|
|
|
|
|
|
|
handle.Start(); |
|
|
|
handle.Start(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Starting with more than one AllowOneRpc tokens can significantly increase |
|
|
|
|
|
|
|
// unary RPC throughput. |
|
|
|
|
|
|
|
for (int i = 0; i < InitialAllowRpcTokenCount; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
AllowOneRpc(); |
|
|
|
AllowOneRpc(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Requests server shutdown and when there are no more calls being serviced, |
|
|
|
/// Requests server shutdown and when there are no more calls being serviced, |
|
|
|