aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/Grpc.Core/Internal')
-rw-r--r--src/csharp/Grpc.Core/Internal/AsyncCall.cs16
-rw-r--r--src/csharp/Grpc.Core/Internal/AsyncCallBase.cs30
-rw-r--r--src/csharp/Grpc.Core/Internal/AsyncCallServer.cs18
-rw-r--r--src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs2
-rw-r--r--src/csharp/Grpc.Core/Internal/CompletionRegistry.cs6
-rw-r--r--src/csharp/Grpc.Core/Internal/Enums.cs4
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs2
-rw-r--r--src/csharp/Grpc.Core/Internal/ServerCallHandler.cs10
-rw-r--r--src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs2
-rw-r--r--src/csharp/Grpc.Core/Internal/Timespec.cs6
-rw-r--r--src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs2
11 files changed, 49 insertions, 49 deletions
diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs
index 7dc4490281..2caba260b3 100644
--- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs
+++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs
@@ -99,7 +99,7 @@ namespace Grpc.Core.Internal
lock (myLock)
{
- Preconditions.CheckState(!started);
+ GrpcPreconditions.CheckState(!started);
started = true;
Initialize(cq);
@@ -141,7 +141,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(!started);
+ GrpcPreconditions.CheckState(!started);
started = true;
Initialize(environment.CompletionQueue);
@@ -168,7 +168,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(!started);
+ GrpcPreconditions.CheckState(!started);
started = true;
Initialize(environment.CompletionQueue);
@@ -192,7 +192,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(!started);
+ GrpcPreconditions.CheckState(!started);
started = true;
Initialize(environment.CompletionQueue);
@@ -217,7 +217,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(!started);
+ GrpcPreconditions.CheckState(!started);
started = true;
Initialize(environment.CompletionQueue);
@@ -257,7 +257,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
+ GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
CheckSendingAllowed();
call.StartSendCloseFromClient(HandleHalfclosed);
@@ -297,7 +297,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(finishedStatus.HasValue, "Status can only be accessed once the call has finished.");
+ GrpcPreconditions.CheckState(finishedStatus.HasValue, "Status can only be accessed once the call has finished.");
return finishedStatus.Value.Status;
}
}
@@ -310,7 +310,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(finishedStatus.HasValue, "Trailers can only be accessed once the call has finished.");
+ GrpcPreconditions.CheckState(finishedStatus.HasValue, "Trailers can only be accessed once the call has finished.");
return finishedStatus.Value.Trailers;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
index 81a9a40fcc..45d4c3e078 100644
--- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
+++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs
@@ -79,9 +79,9 @@ namespace Grpc.Core.Internal
public AsyncCallBase(Func<TWrite, byte[]> serializer, Func<byte[], TRead> deserializer, GrpcEnvironment environment)
{
- this.serializer = Preconditions.CheckNotNull(serializer);
- this.deserializer = Preconditions.CheckNotNull(deserializer);
- this.environment = Preconditions.CheckNotNull(environment);
+ this.serializer = GrpcPreconditions.CheckNotNull(serializer);
+ this.deserializer = GrpcPreconditions.CheckNotNull(deserializer);
+ this.environment = GrpcPreconditions.CheckNotNull(environment);
}
/// <summary>
@@ -91,7 +91,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckState(started);
+ GrpcPreconditions.CheckState(started);
cancelRequested = true;
if (!disposed)
@@ -135,7 +135,7 @@ namespace Grpc.Core.Internal
lock (myLock)
{
- Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
+ GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
CheckSendingAllowed();
call.StartSendMessage(HandleSendFinished, payload, writeFlags, !initialMetadataSent);
@@ -154,7 +154,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
+ GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
CheckReadingAllowed();
call.StartReceiveMessage(HandleReadFinished);
@@ -204,22 +204,22 @@ namespace Grpc.Core.Internal
protected void CheckSendingAllowed()
{
- Preconditions.CheckState(started);
+ GrpcPreconditions.CheckState(started);
CheckNotCancelled();
- Preconditions.CheckState(!disposed);
+ GrpcPreconditions.CheckState(!disposed);
- Preconditions.CheckState(!halfcloseRequested, "Already halfclosed.");
- Preconditions.CheckState(!finished, "Already finished.");
- Preconditions.CheckState(sendCompletionDelegate == null, "Only one write can be pending at a time");
+ GrpcPreconditions.CheckState(!halfcloseRequested, "Already halfclosed.");
+ GrpcPreconditions.CheckState(!finished, "Already finished.");
+ GrpcPreconditions.CheckState(sendCompletionDelegate == null, "Only one write can be pending at a time");
}
protected virtual void CheckReadingAllowed()
{
- Preconditions.CheckState(started);
- Preconditions.CheckState(!disposed);
+ GrpcPreconditions.CheckState(started);
+ GrpcPreconditions.CheckState(!disposed);
- Preconditions.CheckState(!readingDone, "Stream has already been closed.");
- Preconditions.CheckState(readCompletionDelegate == null, "Only one read can be pending at a time");
+ GrpcPreconditions.CheckState(!readingDone, "Stream has already been closed.");
+ GrpcPreconditions.CheckState(readCompletionDelegate == null, "Only one read can be pending at a time");
}
protected void CheckNotCancelled()
diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs
index 6752d3fab3..b72cbd795f 100644
--- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs
+++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs
@@ -53,7 +53,7 @@ namespace Grpc.Core.Internal
public AsyncCallServer(Func<TResponse, byte[]> serializer, Func<byte[], TRequest> deserializer, GrpcEnvironment environment, Server server) : base(serializer, deserializer, environment)
{
- this.server = Preconditions.CheckNotNull(server);
+ this.server = GrpcPreconditions.CheckNotNull(server);
}
public void Initialize(CallSafeHandle call)
@@ -71,7 +71,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckNotNull(call);
+ GrpcPreconditions.CheckNotNull(call);
started = true;
@@ -108,14 +108,14 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckNotNull(headers, "metadata");
- Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
+ GrpcPreconditions.CheckNotNull(headers, "metadata");
+ GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
- Preconditions.CheckState(!initialMetadataSent, "Response headers can only be sent once per call.");
- Preconditions.CheckState(streamingWritesCounter == 0, "Response headers can only be sent before the first write starts.");
+ GrpcPreconditions.CheckState(!initialMetadataSent, "Response headers can only be sent once per call.");
+ GrpcPreconditions.CheckState(streamingWritesCounter == 0, "Response headers can only be sent before the first write starts.");
CheckSendingAllowed();
- Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
+ GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
using (var metadataArray = MetadataArraySafeHandle.Create(headers))
{
@@ -136,7 +136,7 @@ namespace Grpc.Core.Internal
{
lock (myLock)
{
- Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
+ GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
CheckSendingAllowed();
using (var metadataArray = MetadataArraySafeHandle.Create(trailers))
@@ -177,7 +177,7 @@ namespace Grpc.Core.Internal
protected override void CheckReadingAllowed()
{
base.CheckReadingAllowed();
- Preconditions.CheckArgument(!cancelRequested);
+ GrpcPreconditions.CheckArgument(!cancelRequested);
}
protected override void OnAfterReleaseResources()
diff --git a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs
index 9d7a990c42..5c75b52e23 100644
--- a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs
@@ -101,7 +101,7 @@ namespace Grpc.Core.Internal
{
bool success = false;
shutdownRefcount.IncrementIfNonzero(ref success);
- Preconditions.CheckState(success, "Shutdown has already been called");
+ GrpcPreconditions.CheckState(success, "Shutdown has already been called");
}
private void EndOp()
diff --git a/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs b/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs
index 2796c959a3..3a293e1626 100644
--- a/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs
+++ b/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -59,7 +59,7 @@ namespace Grpc.Core.Internal
public void Register(IntPtr key, OpCompletionDelegate callback)
{
environment.DebugStats.PendingBatchCompletions.Increment();
- Preconditions.CheckState(dict.TryAdd(key, callback));
+ GrpcPreconditions.CheckState(dict.TryAdd(key, callback));
}
public void RegisterBatchCompletion(BatchContextSafeHandle ctx, BatchCompletionDelegate callback)
@@ -71,7 +71,7 @@ namespace Grpc.Core.Internal
public OpCompletionDelegate Extract(IntPtr key)
{
OpCompletionDelegate value;
- Preconditions.CheckState(dict.TryRemove(key, out value));
+ GrpcPreconditions.CheckState(dict.TryRemove(key, out value));
environment.DebugStats.PendingBatchCompletions.Decrement();
return value;
}
diff --git a/src/csharp/Grpc.Core/Internal/Enums.cs b/src/csharp/Grpc.Core/Internal/Enums.cs
index b0eab2001b..098e7c0e99 100644
--- a/src/csharp/Grpc.Core/Internal/Enums.cs
+++ b/src/csharp/Grpc.Core/Internal/Enums.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -72,7 +72,7 @@ namespace Grpc.Core.Internal
/// </summary>
public static void CheckOk(this GRPCCallError callError)
{
- Preconditions.CheckState(callError == GRPCCallError.OK, "Call error: " + callError);
+ GrpcPreconditions.CheckState(callError == GRPCCallError.OK, "Call error: " + callError);
}
}
diff --git a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
index 36b865c09c..e810ffcdd0 100644
--- a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
+++ b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
@@ -53,7 +53,7 @@ namespace Grpc.Core.Internal
public NativeMetadataCredentialsPlugin(AsyncAuthInterceptor interceptor)
{
- this.interceptor = Preconditions.CheckNotNull(interceptor, "interceptor");
+ this.interceptor = GrpcPreconditions.CheckNotNull(interceptor, "interceptor");
this.nativeInterceptor = NativeMetadataInterceptorHandler;
// Make sure the callback doesn't get garbage collected until it is destroyed.
diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
index de66759b94..ccf144de2d 100644
--- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
+++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -78,10 +78,10 @@ namespace Grpc.Core.Internal
var context = HandlerUtils.NewContext(newRpc, asyncCall.Peer, responseStream, asyncCall.CancellationToken);
try
{
- Preconditions.CheckArgument(await requestStream.MoveNext().ConfigureAwait(false));
+ GrpcPreconditions.CheckArgument(await requestStream.MoveNext().ConfigureAwait(false));
var request = requestStream.Current;
// TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated.
- Preconditions.CheckArgument(!await requestStream.MoveNext().ConfigureAwait(false));
+ GrpcPreconditions.CheckArgument(!await requestStream.MoveNext().ConfigureAwait(false));
var result = await handler(request, context).ConfigureAwait(false);
status = context.Status;
await responseStream.WriteAsync(result).ConfigureAwait(false);
@@ -134,10 +134,10 @@ namespace Grpc.Core.Internal
var context = HandlerUtils.NewContext(newRpc, asyncCall.Peer, responseStream, asyncCall.CancellationToken);
try
{
- Preconditions.CheckArgument(await requestStream.MoveNext().ConfigureAwait(false));
+ GrpcPreconditions.CheckArgument(await requestStream.MoveNext().ConfigureAwait(false));
var request = requestStream.Current;
// TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated.
- Preconditions.CheckArgument(!await requestStream.MoveNext().ConfigureAwait(false));
+ GrpcPreconditions.CheckArgument(!await requestStream.MoveNext().ConfigureAwait(false));
await handler(request, responseStream, context).ConfigureAwait(false);
status = context.Status;
}
diff --git a/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs
index a1d080c7f1..a50f357990 100644
--- a/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs
@@ -49,7 +49,7 @@ namespace Grpc.Core.Internal
public static ServerCredentialsSafeHandle CreateSslCredentials(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, bool forceClientAuth)
{
- Preconditions.CheckArgument(keyCertPairCertChainArray.Length == keyCertPairPrivateKeyArray.Length);
+ GrpcPreconditions.CheckArgument(keyCertPairCertChainArray.Length == keyCertPairPrivateKeyArray.Length);
return Native.grpcsharp_ssl_server_credentials_create(pemRootCerts,
keyCertPairCertChainArray, keyCertPairPrivateKeyArray,
new UIntPtr((ulong)keyCertPairCertChainArray.Length),
diff --git a/src/csharp/Grpc.Core/Internal/Timespec.cs b/src/csharp/Grpc.Core/Internal/Timespec.cs
index 148d877da5..754be4e035 100644
--- a/src/csharp/Grpc.Core/Internal/Timespec.cs
+++ b/src/csharp/Grpc.Core/Internal/Timespec.cs
@@ -141,8 +141,8 @@ namespace Grpc.Core.Internal
/// </summary>
public DateTime ToDateTime()
{
- Preconditions.CheckState(tv_nsec >= 0 && tv_nsec < NanosPerSecond);
- Preconditions.CheckState(clock_type == GPRClockType.Realtime);
+ GrpcPreconditions.CheckState(tv_nsec >= 0 && tv_nsec < NanosPerSecond);
+ GrpcPreconditions.CheckState(clock_type == GPRClockType.Realtime);
// fast path for InfFuture
if (this.Equals(InfFuture))
@@ -195,7 +195,7 @@ namespace Grpc.Core.Internal
return Timespec.InfPast;
}
- Preconditions.CheckArgument(dateTime.Kind == DateTimeKind.Utc, "dateTime needs of kind DateTimeKind.Utc or be equal to DateTime.MaxValue or DateTime.MinValue.");
+ GrpcPreconditions.CheckArgument(dateTime.Kind == DateTimeKind.Utc, "dateTime needs of kind DateTimeKind.Utc or be equal to DateTime.MaxValue or DateTime.MinValue.");
try
{
diff --git a/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs b/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
index 95a8797e3e..e763c15025 100644
--- a/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
+++ b/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
@@ -65,7 +65,7 @@ namespace Grpc.Core.Internal
public UnmanagedLibrary(string libraryPath)
{
- this.libraryPath = Preconditions.CheckNotNull(libraryPath);
+ this.libraryPath = GrpcPreconditions.CheckNotNull(libraryPath);
if (!File.Exists(this.libraryPath))
{