diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cpp/util/byte_buffer_cc.cc | 5 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/Channel.cs | 35 |
2 files changed, 4 insertions, 36 deletions
diff --git a/src/cpp/util/byte_buffer_cc.cc b/src/cpp/util/byte_buffer_cc.cc index 8700f96d8d..a7e1645435 100644 --- a/src/cpp/util/byte_buffer_cc.cc +++ b/src/cpp/util/byte_buffer_cc.cc @@ -43,8 +43,9 @@ Status ByteBuffer::Dump(std::vector<Slice>* slices) const { return Status::OK; } -ByteBuffer::ByteBuffer(const ByteBuffer& buf) - : buffer_(grpc_byte_buffer_copy(buf.buffer_)) {} +ByteBuffer::ByteBuffer(const ByteBuffer& buf) : buffer_(nullptr) { + operator=(buf); +} ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) { if (this != &buf) { diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index abe19a6fc6..e9930b6fbc 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -44,8 +44,6 @@ namespace Grpc.Core readonly ChannelSafeHandle handle; readonly Dictionary<string, ChannelOption> options; - readonly Task connectivityWatcherTask; - bool shutdownRequested; /// <summary> @@ -86,9 +84,6 @@ namespace Grpc.Core this.handle = ChannelSafeHandle.CreateInsecure(target, nativeChannelArgs); } } - // TODO(jtattermusch): Workaround for https://github.com/GoogleCloudPlatform/google-cloud-dotnet/issues/822. - // Remove once retries are supported in C core - this.connectivityWatcherTask = RunConnectivityWatcherAsync(); GrpcEnvironment.RegisterChannel(this); } @@ -259,7 +254,7 @@ namespace Grpc.Core handle.Dispose(); } - await Task.WhenAll(GrpcEnvironment.ReleaseAsync(), connectivityWatcherTask).ConfigureAwait(false); + await GrpcEnvironment.ReleaseAsync().ConfigureAwait(false); } internal ChannelSafeHandle Handle @@ -317,34 +312,6 @@ namespace Grpc.Core } } - /// <summary> - /// Constantly Watches channel connectivity status to work around https://github.com/GoogleCloudPlatform/google-cloud-dotnet/issues/822 - /// </summary> - private async Task RunConnectivityWatcherAsync() - { - try - { - var lastState = State; - while (lastState != ChannelState.Shutdown) - { - lock (myLock) - { - if (shutdownRequested) - { - break; - } - } - - // ignore the result - await WaitForStateChangedInternalAsync(lastState, DateTime.UtcNow.AddSeconds(1)).ConfigureAwait(false); - lastState = State; - } - } - catch (ObjectDisposedException) { - // during shutdown, channel is going to be disposed. - } - } - private static void EnsureUserAgentChannelOption(Dictionary<string, ChannelOption> options) { var key = ChannelOptions.PrimaryUserAgentString; |