Merge branch 'master' into rq-threads

pull/16081/head
Sree Kuchibhotla 7 years ago
commit 9b84d7fe21
  1. 6
      .github/mergeable.yml
  2. 53
      doc/csharp/server_reflection.md
  3. 26
      doc/interop-test-descriptions.md
  4. 13
      doc/server-reflection.md
  5. 2
      doc/server_reflection_tutorial.md
  6. 0
      examples/csharp/Helloworld/Greeter.sln
  7. 4
      examples/csharp/Helloworld/Greeter/Greeter.csproj
  8. 0
      examples/csharp/Helloworld/Greeter/Helloworld.cs
  9. 0
      examples/csharp/Helloworld/Greeter/HelloworldGrpc.cs
  10. 0
      examples/csharp/Helloworld/GreeterClient/GreeterClient.csproj
  11. 0
      examples/csharp/Helloworld/GreeterClient/Program.cs
  12. 0
      examples/csharp/Helloworld/GreeterServer/GreeterServer.csproj
  13. 0
      examples/csharp/Helloworld/GreeterServer/Program.cs
  14. 13
      examples/csharp/Helloworld/README.md
  15. 0
      examples/csharp/Helloworld/generate_protos.bat
  16. 0
      examples/csharp/HelloworldLegacyCsproj/Greeter.sln
  17. 0
      examples/csharp/HelloworldLegacyCsproj/Greeter/.gitignore
  18. 16
      examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj
  19. 0
      examples/csharp/HelloworldLegacyCsproj/Greeter/Helloworld.cs
  20. 0
      examples/csharp/HelloworldLegacyCsproj/Greeter/HelloworldGrpc.cs
  21. 0
      examples/csharp/HelloworldLegacyCsproj/Greeter/Properties/AssemblyInfo.cs
  22. 6
      examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config
  23. 0
      examples/csharp/HelloworldLegacyCsproj/GreeterClient/.gitignore
  24. 16
      examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj
  25. 0
      examples/csharp/HelloworldLegacyCsproj/GreeterClient/Program.cs
  26. 0
      examples/csharp/HelloworldLegacyCsproj/GreeterClient/Properties/AssemblyInfo.cs
  27. 4
      examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config
  28. 0
      examples/csharp/HelloworldLegacyCsproj/GreeterServer/.gitignore
  29. 16
      examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj
  30. 0
      examples/csharp/HelloworldLegacyCsproj/GreeterServer/Program.cs
  31. 0
      examples/csharp/HelloworldLegacyCsproj/GreeterServer/Properties/AssemblyInfo.cs
  32. 4
      examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config
  33. 8
      examples/csharp/HelloworldLegacyCsproj/README.md
  34. 0
      examples/csharp/HelloworldLegacyCsproj/generate_protos.bat
  35. 0
      examples/csharp/RouteGuide/.gitignore
  36. 0
      examples/csharp/RouteGuide/README.md
  37. 10
      examples/csharp/RouteGuide/RouteGuide.sln
  38. 0
      examples/csharp/RouteGuide/RouteGuide/RouteGuide.cs
  39. 25
      examples/csharp/RouteGuide/RouteGuide/RouteGuide.csproj
  40. 0
      examples/csharp/RouteGuide/RouteGuide/RouteGuideGrpc.cs
  41. 0
      examples/csharp/RouteGuide/RouteGuide/RouteGuideUtil.cs
  42. 0
      examples/csharp/RouteGuide/RouteGuide/route_guide_db.json
  43. 0
      examples/csharp/RouteGuide/RouteGuideClient/Program.cs
  44. 16
      examples/csharp/RouteGuide/RouteGuideClient/RouteGuideClient.csproj
  45. 0
      examples/csharp/RouteGuide/RouteGuideServer/Program.cs
  46. 0
      examples/csharp/RouteGuide/RouteGuideServer/RouteGuideImpl.cs
  47. 16
      examples/csharp/RouteGuide/RouteGuideServer/RouteGuideServer.csproj
  48. 0
      examples/csharp/RouteGuide/generate_protos.bat
  49. 54
      examples/csharp/route_guide/RouteGuide/Properties/AssemblyInfo.cs
  50. 92
      examples/csharp/route_guide/RouteGuide/RouteGuide.csproj
  51. 8
      examples/csharp/route_guide/RouteGuide/packages.config
  52. 54
      examples/csharp/route_guide/RouteGuideClient/Properties/AssemblyInfo.cs
  53. 89
      examples/csharp/route_guide/RouteGuideClient/RouteGuideClient.csproj
  54. 8
      examples/csharp/route_guide/RouteGuideClient/packages.config
  55. 54
      examples/csharp/route_guide/RouteGuideServer/Properties/AssemblyInfo.cs
  56. 90
      examples/csharp/route_guide/RouteGuideServer/RouteGuideServer.csproj
  57. 9
      examples/csharp/route_guide/RouteGuideServer/packages.config
  58. 6
      include/grpc/grpc_security.h
  59. 6
      include/grpc/grpc_security_constants.h
  60. 5
      include/grpcpp/security/credentials.h
  61. 4
      include/grpcpp/security/server_credentials.h
  62. 4
      src/core/ext/filters/client_channel/client_channel_channelz.cc
  63. 15
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  64. 13
      src/core/ext/transport/chttp2/transport/internal.h
  65. 17
      src/core/ext/transport/chttp2/transport/stream_lists.cc
  66. 6
      src/core/lib/gprpp/orphanable.h
  67. 6
      src/core/lib/gprpp/ref_counted.h
  68. 78
      src/core/lib/gprpp/ref_counted_ptr.h
  69. 19
      src/core/lib/iomgr/ev_epoll1_linux.cc
  70. 28
      src/core/lib/iomgr/ev_epollex_linux.cc
  71. 25
      src/core/lib/iomgr/ev_epollsig_linux.cc
  72. 46
      src/core/lib/iomgr/ev_poll_posix.cc
  73. 4
      src/core/lib/iomgr/ev_posix.h
  74. 7
      src/cpp/client/secure_credentials.cc
  75. 6
      src/cpp/server/secure_server_credentials.cc
  76. 2
      src/objective-c/tests/build_one_example.sh
  77. 12
      src/python/grpcio_health_checking/grpc_health/v1/health.py
  78. 32
      src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
  79. 3
      src/python/grpcio_tests/tests/health_check/_health_servicer_test.py
  80. 4
      src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py
  81. 25
      src/ruby/ext/grpc/extconf.rb
  82. 10
      test/core/channel/channel_trace_test.cc
  83. 63
      test/core/gprpp/ref_counted_ptr_test.cc
  84. 24
      test/cpp/qps/client.h
  85. 4
      tools/internal_ci/helper_scripts/prepare_build_macos_rc
  86. 9
      tools/profiling/ios_bin/binary_size.py
  87. 28
      tools/run_tests/performance/README.md

@ -0,0 +1,6 @@
mergeable:
pull_requests:
label:
must_include:
regex: "release notes: yes|release notes: no"
message: "Add release notes yes/no label. For yes, add lang label"

@ -0,0 +1,53 @@
# gRPC C# Server Reflection
This document shows how to use gRPC Server Reflection in gRPC C#.
Please see [C++ Server Reflection Tutorial](../server_reflection_tutorial.md)
for general information and more examples how to use server reflection.
## Enable server reflection in C# servers
C# Server Reflection is an add-on library.
To use it, first install the [Grpc.Reflection](https://www.nuget.org/packages/Grpc.Reflection/)
Nuget package into your project.
Note that with C# you need to manually register the service
descriptors with the reflection service implementation when creating a server
(this isn't necessary with e.g. C++ or Java)
```csharp
// the reflection service will be aware of "Greeter" and "ServerReflection" services.
var reflectionServiceImpl = new ReflectionServiceImpl(Greeter.Descriptor, ServerReflection.Descriptor);
server = new Server()
{
Services =
{
// the server will serve 2 services, the Greeter and the ServerReflection
ServerReflection.BindService(new GreeterImpl()),
ServerReflection.BindService(reflectionServiceImpl)
},
Ports = { { "localhost", 50051, ServerCredentials.Insecure } }
};
server.Start();
```
After starting the server, you can verify that the server reflection
is working properly by using the `grpc_cli` command line tool:
```sh
$ grpc_cli ls localhost:50051
```
output:
```sh
helloworld.Greeter
grpc.reflection.v1alpha.ServerReflection
```
For more examples and instructions how to use the `grpc_cli` tool,
please refer to the [`grpc_cli` documentation](../command_line_tool.md)
and the [C++ Server Reflection Tutorial](../server_reflection_tutorial.md).
## Additional Resources
The [Server Reflection Protocol](../server-reflection.md) provides detailed
information about how the server reflection works and describes the server reflection
protocol in detail.

@ -784,6 +784,32 @@ Client asserts:
* received status message is the same as the sent message for both Procedure * received status message is the same as the sent message for both Procedure
steps 1 and 2 steps 1 and 2
### special_status_message
This test verifies Unicode and whitespace is correctly processed in status
message. "\t" is horizontal tab. "\r" is carriage return. "\n" is line feed.
Server features:
* [UnaryCall][]
* [Echo Status][]
Procedure:
1. Client calls UnaryCall with:
```
{
response_status:{
code: 2
message: "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n"
}
}
```
Client asserts:
* received status code is the same as the sent code for Procedure step 1
* received status message is the same as the sent message for Procedure step 1,
including all whitespace characters
### unimplemented_method ### unimplemented_method
This test verifies that calling an unimplemented RPC method returns the This test verifies that calling an unimplemented RPC method returns the

@ -181,3 +181,16 @@ will need to index those FileDescriptorProtos by file and symbol and imports.
One issue is that some grpc implementations are very loosely coupled with One issue is that some grpc implementations are very loosely coupled with
protobufs; in such implementations it probably makes sense to split apart these protobufs; in such implementations it probably makes sense to split apart these
reflection APIs so as not to take an additional proto dependency. reflection APIs so as not to take an additional proto dependency.
## Known Implementations
Enabling server reflection differs language-to-language. Here are links to docs relevant to
each language:
- [Java](https://github.com/grpc/grpc-java/blob/master/documentation/server-reflection-tutorial.md#enable-server-reflection)
- [Go](https://github.com/grpc/grpc-go/blob/master/Documentation/server-reflection-tutorial.md#enable-server-reflection)
- [C++](https://grpc.io/grpc/cpp/md_doc_server_reflection_tutorial.html)
- [C#](https://github.com/grpc/grpc/blob/master/doc/csharp/server_reflection.md)
- Python: (tutorial not yet written)
- Ruby: not yet implemented [#2567](https://github.com/grpc/grpc/issues/2567)
- Node: not yet implemented [#2568](https://github.com/grpc/grpc/issues/2568)

@ -10,7 +10,7 @@ RPCs.
### Enable server reflection in C++ servers ### Enable server reflection in C++ servers
C++ Server Reflection is an add-on library, `libgrpc++_reflction`. To enable C++ C++ Server Reflection is an add-on library, `libgrpc++_reflection`. To enable C++
server reflection, you can link this library to your server binary. server reflection, you can link this library to your server binary.
Some platforms (e.g. Ubuntu 11.10 onwards) only link in libraries that directly Some platforms (e.g. Ubuntu 11.10 onwards) only link in libraries that directly

@ -11,8 +11,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.5.0" /> <PackageReference Include="Google.Protobuf" Version="3.5.0" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.5.0" /> <PackageReference Include="Google.Protobuf.Tools" Version="3.5.0" />
<PackageReference Include="Grpc" Version="1.8.0" /> <PackageReference Include="Grpc" Version="1.13.1" />
<PackageReference Include="Grpc.Tools" Version="1.8.0" /> <PackageReference Include="Grpc.Tools" Version="1.13.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -3,9 +3,6 @@ gRPC in 3 minutes (C#)
BACKGROUND BACKGROUND
------------- -------------
This is a different version of the helloworld example, using the dotnet sdk
tools to build and run.
For this sample, we've already generated the server and client stubs from [helloworld.proto][]. For this sample, we've already generated the server and client stubs from [helloworld.proto][].
Example projects in this directory depend on the [Grpc](https://www.nuget.org/packages/Grpc/) Example projects in this directory depend on the [Grpc](https://www.nuget.org/packages/Grpc/)
@ -15,17 +12,19 @@ which have been already added to the project for you.
PREREQUISITES PREREQUISITES
------------- -------------
- The [.NET Core SDK](https://www.microsoft.com/net/core). - The [.NET Core SDK](https://www.microsoft.com/net/core) (version 2+ is recommended)
You can also build the example directly using Visual Studio 2017, but it's not a requirement.
BUILD BUILD
------- -------
From the `examples/csharp/helloworld-from-cli` directory: From the `examples/csharp/Helloworld` directory:
- `dotnet restore Greeter.sln`
- `dotnet build Greeter.sln` - `dotnet build Greeter.sln`
(if you're using dotnet SDK 1.x you need to run `dotnet restore Greeter.sln` first)
Try it! Try it!
------- -------

@ -36,15 +36,15 @@
<HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<HintPath>..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> <Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Grpc.Core">
<HintPath>..\packages\Grpc.Core.1.13.1\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@ -62,11 +62,5 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<Import Project="..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" /> <Import Project="..\packages\Grpc.Core.1.13.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.13.1\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets'))" />
</Target>
</Project> </Project>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Google.Protobuf" version="3.5.0" targetFramework="net45" /> <package id="Google.Protobuf" version="3.5.0" targetFramework="net45" />
<package id="Grpc" version="1.8.0" targetFramework="net45" /> <package id="Grpc" version="1.13.1" targetFramework="net45" />
<package id="Grpc.Core" version="1.8.0" targetFramework="net45" /> <package id="Grpc.Core" version="1.13.1" targetFramework="net45" />
<package id="Grpc.Tools" version="1.8.0" targetFramework="net45" /> <package id="Grpc.Tools" version="1.13.1" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages> </packages>

@ -36,15 +36,15 @@
<HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<HintPath>..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> <Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Grpc.Core">
<HintPath>..\packages\Grpc.Core.1.13.1\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
@ -60,11 +60,5 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" /> <Import Project="..\packages\Grpc.Core.1.13.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.13.1\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets'))" />
</Target>
</Project> </Project>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Google.Protobuf" version="3.5.0" targetFramework="net45" /> <package id="Google.Protobuf" version="3.5.0" targetFramework="net45" />
<package id="Grpc" version="1.8.0" targetFramework="net45" /> <package id="Grpc" version="1.13.1" targetFramework="net45" />
<package id="Grpc.Core" version="1.8.0" targetFramework="net45" /> <package id="Grpc.Core" version="1.13.1" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages> </packages>

@ -36,15 +36,15 @@
<HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<HintPath>..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> <Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Grpc.Core">
<HintPath>..\packages\Grpc.Core.1.13.1\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
@ -60,11 +60,5 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" /> <Import Project="..\packages\Grpc.Core.1.13.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.13.1\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets'))" />
</Target>
</Project> </Project>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Google.Protobuf" version="3.5.0" targetFramework="net45" /> <package id="Google.Protobuf" version="3.5.0" targetFramework="net45" />
<package id="Grpc" version="1.8.0" targetFramework="net45" /> <package id="Grpc" version="1.13.1" targetFramework="net45" />
<package id="Grpc.Core" version="1.8.0" targetFramework="net45" /> <package id="Grpc.Core" version="1.13.1" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages> </packages>

@ -3,6 +3,11 @@ gRPC in 3 minutes (C#)
BACKGROUND BACKGROUND
------------- -------------
This is a different version of the helloworld example, using the old-style .csproj
files supported by VS2013 and VS2015 (and older versions of mono).
You can still use gRPC with the old-style .csproj files, but [using the new-style
.csproj projects](../helloworld/README.md) (supported by VS2017 and dotnet SDK) is recommended.
For this sample, we've already generated the server and client stubs from [helloworld.proto][]. For this sample, we've already generated the server and client stubs from [helloworld.proto][].
Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/), [Grpc.Tools](https://www.nuget.org/packages/Grpc.Tools/) Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/), [Grpc.Tools](https://www.nuget.org/packages/Grpc.Tools/)
@ -28,7 +33,7 @@ BUILD
# Using Monodevelop or Xamarin Studio # Using Monodevelop or Xamarin Studio
The nuget add-in available for Xamarin Studio and Monodevelop IDEs is too old to The nuget add-in available for Xamarin Studio and Monodevelop IDEs is too old to
download all of the nuget dependencies of gRPC. One alternative to is to use the dotnet command line tools instead (see [helloworld-from-cli]). download all of the nuget dependencies of gRPC.
Using these IDEs, a workaround is as follows: Using these IDEs, a workaround is as follows:
* Obtain a nuget executable for your platform and update it with * Obtain a nuget executable for your platform and update it with
@ -62,6 +67,5 @@ Tutorial
You can find a more detailed tutorial in [gRPC Basics: C#][] You can find a more detailed tutorial in [gRPC Basics: C#][]
[helloworld-from-cli]:../helloworld-from-cli/README.md
[helloworld.proto]:../../protos/helloworld.proto [helloworld.proto]:../../protos/helloworld.proto
[gRPC Basics: C#]:https://grpc.io/docs/tutorials/basic/csharp.html [gRPC Basics: C#]:https://grpc.io/docs/tutorials/basic/csharp.html

@ -1,13 +1,13 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013 # Visual Studio 15
VisualStudioVersion = 12.0.31101.0 VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuide", "RouteGuide\RouteGuide.csproj", "{49954D9C-5F17-4662-96B2-73BE833DD81A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RouteGuide", "RouteGuide\RouteGuide.csproj", "{49954D9C-5F17-4662-96B2-73BE833DD81A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuideClient", "RouteGuideClient\RouteGuideClient.csproj", "{D47BE663-4DE3-4206-B7A8-EA3FA066DADC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RouteGuideClient", "RouteGuideClient\RouteGuideClient.csproj", "{D47BE663-4DE3-4206-B7A8-EA3FA066DADC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuideServer", "RouteGuideServer\RouteGuideServer.csproj", "{4B7C7794-BE24-4477-ACE7-18259EB73D27}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RouteGuideServer", "RouteGuideServer\RouteGuideServer.csproj", "{4B7C7794-BE24-4477-ACE7-18259EB73D27}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>RouteGuide</AssemblyTitle>
<TargetFrameworks>netcoreapp1.0</TargetFrameworks>
<DebugType>portable</DebugType>
<AssemblyName>RouteGuide</AssemblyName>
<PackageId>RouteGuide</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.5.0" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.5.0" />
<PackageReference Include="Grpc" Version="1.13.1" />
<PackageReference Include="Grpc.Tools" Version="1.13.1" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
<None Include="route_guide_db.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>RouteGuideClient</AssemblyTitle>
<TargetFrameworks>netcoreapp1.0</TargetFrameworks>
<DebugType>portable</DebugType>
<AssemblyName>RouteGuideClient</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>RouteGuideClient</PackageId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\RouteGuide\RouteGuide.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>RouteGuideServer</AssemblyTitle>
<TargetFrameworks>netcoreapp1.0</TargetFrameworks>
<DebugType>portable</DebugType>
<AssemblyName>RouteGuideServer</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>RouteGuideServer</PackageId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\RouteGuide\RouteGuide.csproj" />
</ItemGroup>
</Project>

@ -1,54 +0,0 @@
#region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RouteGuide")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RouteGuide")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ef6b85bc-ac27-46de-8714-a658236cc6fb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{49954D9C-5F17-4662-96B2-73BE833DD81A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RouteGuide</RootNamespace>
<AssemblyName>RouteGuide</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.5.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<HintPath>..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RouteGuide.cs" />
<Compile Include="RouteGuideGrpc.cs" />
<Compile Include="RouteGuideUtil.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\protos\route_guide.proto">
<Link>protos\route_guide.proto</Link>
</None>
<None Include="..\generate_protos.bat">
<Link>generate_protos.bat</Link>
</None>
<None Include="packages.config" />
<None Include="route_guide_db.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.5.0" targetFramework="net45" />
<package id="Grpc" version="1.8.0" targetFramework="net45" />
<package id="Grpc.Core" version="1.8.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages>

@ -1,54 +0,0 @@
#region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RouteGuideClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RouteGuideClient")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("914644eb-47cd-4a37-9fba-5e62dd432333")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D47BE663-4DE3-4206-B7A8-EA3FA066DADC}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RouteGuideClient</RootNamespace>
<AssemblyName>RouteGuideClient</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.5.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<HintPath>..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RouteGuide\RouteGuide.csproj">
<Project>{49954d9c-5f17-4662-96b2-73be833dd81a}</Project>
<Name>RouteGuide</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.5.0" targetFramework="net45" />
<package id="Grpc" version="1.8.0" targetFramework="net45" />
<package id="Grpc.Core" version="1.8.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages>

@ -1,54 +0,0 @@
#region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RouteGuideServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RouteGuideServer")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("908bdeef-05cc-42bf-9498-c4c573df8925")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4B7C7794-BE24-4477-ACE7-18259EB73D27}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RouteGuideServer</RootNamespace>
<AssemblyName>RouteGuideServer</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.5.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<HintPath>..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Interactive.Async, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RouteGuideImpl.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RouteGuide\RouteGuide.csproj">
<Project>{49954d9c-5f17-4662-96b2-73be833dd81a}</Project>
<Name>RouteGuide</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.8.0\build\net45\Grpc.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.5.0" targetFramework="net45" />
<package id="Grpc" version="1.8.0" targetFramework="net45" />
<package id="Grpc.Core" version="1.8.0" targetFramework="net45" />
<package id="Grpc.Tools" version="1.8.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" />
</packages>

@ -587,12 +587,6 @@ GRPCAPI grpc_server_credentials* grpc_alts_server_credentials_create(
/** --- Local channel/server credentials --- **/ /** --- Local channel/server credentials --- **/
/**
* Type of local connection for which local channel/server credentials will be
* applied. It only supports UDS for now.
*/
typedef enum { UDS = 0 } grpc_local_connect_type;
/** /**
* This method creates a local channel credential object. It is used for * This method creates a local channel credential object. It is used for
* experimental purpose for now and subject to change. * experimental purpose for now and subject to change.

@ -100,6 +100,12 @@ typedef enum {
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
} grpc_ssl_client_certificate_request_type; } grpc_ssl_client_certificate_request_type;
/**
* Type of local connection for which local channel/server credentials will be
* applied. It only supports UDS for now.
*/
typedef enum { UDS = 0 } grpc_local_connect_type;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -23,6 +23,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <grpc/grpc_security_constants.h>
#include <grpcpp/impl/codegen/grpc_library.h> #include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/security/auth_context.h> #include <grpcpp/security/auth_context.h>
#include <grpcpp/support/status.h> #include <grpcpp/support/status.h>
@ -234,6 +235,10 @@ struct AltsCredentialsOptions {
std::shared_ptr<ChannelCredentials> AltsCredentials( std::shared_ptr<ChannelCredentials> AltsCredentials(
const AltsCredentialsOptions& options); const AltsCredentialsOptions& options);
/// Builds Local Credentials.
std::shared_ptr<ChannelCredentials> LocalCredentials(
grpc_local_connect_type type);
} // namespace experimental } // namespace experimental
} // namespace grpc } // namespace grpc

@ -97,6 +97,10 @@ struct AltsServerCredentialsOptions {
std::shared_ptr<ServerCredentials> AltsServerCredentials( std::shared_ptr<ServerCredentials> AltsServerCredentials(
const AltsServerCredentialsOptions& options); const AltsServerCredentialsOptions& options);
/// Builds Local ServerCredentials.
std::shared_ptr<ServerCredentials> LocalServerCredentials(
grpc_local_connect_type type);
} // namespace experimental } // namespace experimental
} // namespace grpc } // namespace grpc

@ -105,8 +105,8 @@ grpc_arg ClientChannelNode::CreateChannelArg() {
RefCountedPtr<ChannelNode> ClientChannelNode::MakeClientChannelNode( RefCountedPtr<ChannelNode> ClientChannelNode::MakeClientChannelNode(
grpc_channel* channel, size_t channel_tracer_max_nodes, grpc_channel* channel, size_t channel_tracer_max_nodes,
bool is_top_level_channel) { bool is_top_level_channel) {
return MakePolymorphicRefCounted<ChannelNode, ClientChannelNode>( return MakeRefCounted<ClientChannelNode>(channel, channel_tracer_max_nodes,
channel, channel_tracer_max_nodes, is_top_level_channel); is_top_level_channel);
} }
} // namespace channelz } // namespace channelz

@ -813,7 +813,11 @@ static void set_write_state(grpc_chttp2_transport* t,
write_state_name(st), reason)); write_state_name(st), reason));
t->write_state = st; t->write_state = st;
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) { if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
GRPC_CLOSURE_LIST_SCHED(&t->run_after_write); grpc_chttp2_stream* s;
while (grpc_chttp2_list_pop_waiting_for_write_stream(t, &s)) {
GRPC_CLOSURE_LIST_SCHED(&s->run_after_write);
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2:write_closure_sched");
}
if (t->close_transport_on_writes_finished != nullptr) { if (t->close_transport_on_writes_finished != nullptr) {
grpc_error* err = t->close_transport_on_writes_finished; grpc_error* err = t->close_transport_on_writes_finished;
t->close_transport_on_writes_finished = nullptr; t->close_transport_on_writes_finished = nullptr;
@ -1208,7 +1212,10 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
!(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) { !(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
GRPC_CLOSURE_RUN(closure, closure->error_data.error); GRPC_CLOSURE_RUN(closure, closure->error_data.error);
} else { } else {
grpc_closure_list_append(&t->run_after_write, closure, if (grpc_chttp2_list_add_waiting_for_write_stream(t, s)) {
GRPC_CHTTP2_STREAM_REF(s, "chttp2:pending_write_closure");
}
grpc_closure_list_append(&s->run_after_write, closure,
closure->error_data.error); closure->error_data.error);
} }
} }
@ -2009,6 +2016,10 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s, void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_error* due_to_error) { grpc_error* due_to_error) {
GRPC_CLOSURE_LIST_SCHED(&s->run_after_write);
if (grpc_chttp2_list_remove_waiting_for_write_stream(t, s)) {
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2:pending_write_closure");
}
if (!t->is_client && !s->sent_trailing_metadata && if (!t->is_client && !s->sent_trailing_metadata &&
grpc_error_has_clear_grpc_status(due_to_error)) { grpc_error_has_clear_grpc_status(due_to_error)) {
close_from_api(t, s, due_to_error); close_from_api(t, s, due_to_error);

@ -54,6 +54,8 @@ typedef enum {
/** streams that are waiting to start because there are too many concurrent /** streams that are waiting to start because there are too many concurrent
streams on the connection */ streams on the connection */
GRPC_CHTTP2_LIST_WAITING_FOR_CONCURRENCY, GRPC_CHTTP2_LIST_WAITING_FOR_CONCURRENCY,
/** streams with closures waiting to be run on a write **/
GRPC_CHTTP2_LIST_WAITING_FOR_WRITE,
STREAM_LIST_COUNT /* must be last */ STREAM_LIST_COUNT /* must be last */
} grpc_chttp2_stream_list_id; } grpc_chttp2_stream_list_id;
@ -431,9 +433,6 @@ struct grpc_chttp2_transport {
*/ */
grpc_error* close_transport_on_writes_finished; grpc_error* close_transport_on_writes_finished;
/* a list of closures to run after writes are finished */
grpc_closure_list run_after_write;
/* buffer pool state */ /* buffer pool state */
/** have we scheduled a benign cleanup? */ /** have we scheduled a benign cleanup? */
bool benign_reclaimer_registered; bool benign_reclaimer_registered;
@ -584,6 +583,7 @@ struct grpc_chttp2_stream {
grpc_slice_buffer flow_controlled_buffer; grpc_slice_buffer flow_controlled_buffer;
grpc_closure_list run_after_write;
grpc_chttp2_write_cb* on_flow_controlled_cbs; grpc_chttp2_write_cb* on_flow_controlled_cbs;
grpc_chttp2_write_cb* on_write_finished_cbs; grpc_chttp2_write_cb* on_write_finished_cbs;
grpc_chttp2_write_cb* finish_after_write; grpc_chttp2_write_cb* finish_after_write;
@ -686,6 +686,13 @@ bool grpc_chttp2_list_pop_stalled_by_stream(grpc_chttp2_transport* t,
bool grpc_chttp2_list_remove_stalled_by_stream(grpc_chttp2_transport* t, bool grpc_chttp2_list_remove_stalled_by_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s); grpc_chttp2_stream* s);
bool grpc_chttp2_list_add_waiting_for_write_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
bool grpc_chttp2_list_pop_waiting_for_write_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream** s);
bool grpc_chttp2_list_remove_waiting_for_write_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
/********* Flow Control ***************/ /********* Flow Control ***************/
// Takes in a flow control action and performs all the needed operations. // Takes in a flow control action and performs all the needed operations.

@ -35,6 +35,8 @@ static const char* stream_list_id_string(grpc_chttp2_stream_list_id id) {
return "stalled_by_stream"; return "stalled_by_stream";
case GRPC_CHTTP2_LIST_WAITING_FOR_CONCURRENCY: case GRPC_CHTTP2_LIST_WAITING_FOR_CONCURRENCY:
return "waiting_for_concurrency"; return "waiting_for_concurrency";
case GRPC_CHTTP2_LIST_WAITING_FOR_WRITE:
return "waiting_for_write";
case STREAM_LIST_COUNT: case STREAM_LIST_COUNT:
GPR_UNREACHABLE_CODE(return "unknown"); GPR_UNREACHABLE_CODE(return "unknown");
} }
@ -214,3 +216,18 @@ bool grpc_chttp2_list_remove_stalled_by_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) { grpc_chttp2_stream* s) {
return stream_list_maybe_remove(t, s, GRPC_CHTTP2_LIST_STALLED_BY_STREAM); return stream_list_maybe_remove(t, s, GRPC_CHTTP2_LIST_STALLED_BY_STREAM);
} }
bool grpc_chttp2_list_add_waiting_for_write_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
return stream_list_add(t, s, GRPC_CHTTP2_LIST_WAITING_FOR_WRITE);
}
bool grpc_chttp2_list_pop_waiting_for_write_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream** s) {
return stream_list_pop(t, s, GRPC_CHTTP2_LIST_WAITING_FOR_WRITE);
}
bool grpc_chttp2_list_remove_waiting_for_write_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
return stream_list_maybe_remove(t, s, GRPC_CHTTP2_LIST_WAITING_FOR_WRITE);
}

@ -86,7 +86,8 @@ class InternallyRefCounted : public Orphanable {
GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
// Allow RefCountedPtr<> to access Unref() and IncrementRefCount(). // Allow RefCountedPtr<> to access Unref() and IncrementRefCount().
friend class RefCountedPtr<Child>; template <typename T>
friend class RefCountedPtr;
InternallyRefCounted() { gpr_ref_init(&refs_, 1); } InternallyRefCounted() { gpr_ref_init(&refs_, 1); }
virtual ~InternallyRefCounted() {} virtual ~InternallyRefCounted() {}
@ -129,7 +130,8 @@ class InternallyRefCountedWithTracing : public Orphanable {
GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
// Allow RefCountedPtr<> to access Unref() and IncrementRefCount(). // Allow RefCountedPtr<> to access Unref() and IncrementRefCount().
friend class RefCountedPtr<Child>; template <typename T>
friend class RefCountedPtr;
InternallyRefCountedWithTracing() InternallyRefCountedWithTracing()
: InternallyRefCountedWithTracing(static_cast<TraceFlag*>(nullptr)) {} : InternallyRefCountedWithTracing(static_cast<TraceFlag*>(nullptr)) {}

@ -73,7 +73,8 @@ class RefCounted {
private: private:
// Allow RefCountedPtr<> to access IncrementRefCount(). // Allow RefCountedPtr<> to access IncrementRefCount().
friend class RefCountedPtr<Child>; template <typename T>
friend class RefCountedPtr;
void IncrementRefCount() { gpr_ref(&refs_); } void IncrementRefCount() { gpr_ref(&refs_); }
@ -152,7 +153,8 @@ class RefCountedWithTracing {
private: private:
// Allow RefCountedPtr<> to access IncrementRefCount(). // Allow RefCountedPtr<> to access IncrementRefCount().
friend class RefCountedPtr<Child>; template <typename T>
friend class RefCountedPtr;
void IncrementRefCount() { gpr_ref(&refs_); } void IncrementRefCount() { gpr_ref(&refs_); }

@ -36,25 +36,49 @@ class RefCountedPtr {
RefCountedPtr(std::nullptr_t) {} RefCountedPtr(std::nullptr_t) {}
// If value is non-null, we take ownership of a ref to it. // If value is non-null, we take ownership of a ref to it.
explicit RefCountedPtr(T* value) { value_ = value; } template <typename Y>
explicit RefCountedPtr(Y* value) {
value_ = value;
}
// Move support. // Move ctors.
RefCountedPtr(RefCountedPtr&& other) { RefCountedPtr(RefCountedPtr&& other) {
value_ = other.value_; value_ = other.value_;
other.value_ = nullptr; other.value_ = nullptr;
} }
template <typename Y>
RefCountedPtr(RefCountedPtr<Y>&& other) {
value_ = other.value_;
other.value_ = nullptr;
}
// Move assignment.
RefCountedPtr& operator=(RefCountedPtr&& other) { RefCountedPtr& operator=(RefCountedPtr&& other) {
if (value_ != nullptr) value_->Unref(); if (value_ != nullptr) value_->Unref();
value_ = other.value_; value_ = other.value_;
other.value_ = nullptr; other.value_ = nullptr;
return *this; return *this;
} }
template <typename Y>
RefCountedPtr& operator=(RefCountedPtr<Y>&& other) {
if (value_ != nullptr) value_->Unref();
value_ = other.value_;
other.value_ = nullptr;
return *this;
}
// Copy support. // Copy ctors.
RefCountedPtr(const RefCountedPtr& other) { RefCountedPtr(const RefCountedPtr& other) {
if (other.value_ != nullptr) other.value_->IncrementRefCount(); if (other.value_ != nullptr) other.value_->IncrementRefCount();
value_ = other.value_; value_ = other.value_;
} }
template <typename Y>
RefCountedPtr(const RefCountedPtr<Y>& other) {
if (other.value_ != nullptr) other.value_->IncrementRefCount();
value_ = other.value_;
}
// Copy assignment.
RefCountedPtr& operator=(const RefCountedPtr& other) { RefCountedPtr& operator=(const RefCountedPtr& other) {
// Note: Order of reffing and unreffing is important here in case value_ // Note: Order of reffing and unreffing is important here in case value_
// and other.value_ are the same object. // and other.value_ are the same object.
@ -63,17 +87,32 @@ class RefCountedPtr {
value_ = other.value_; value_ = other.value_;
return *this; return *this;
} }
template <typename Y>
RefCountedPtr& operator=(const RefCountedPtr<Y>& other) {
// Note: Order of reffing and unreffing is important here in case value_
// and other.value_ are the same object.
if (other.value_ != nullptr) other.value_->IncrementRefCount();
if (value_ != nullptr) value_->Unref();
value_ = other.value_;
return *this;
}
~RefCountedPtr() { ~RefCountedPtr() {
if (value_ != nullptr) value_->Unref(); if (value_ != nullptr) value_->Unref();
} }
// If value is non-null, we take ownership of a ref to it. // If value is non-null, we take ownership of a ref to it.
void reset(T* value = nullptr) { template <typename Y>
void reset(Y* value) {
if (value_ != nullptr) value_->Unref(); if (value_ != nullptr) value_->Unref();
value_ = value; value_ = value;
} }
void reset() {
if (value_ != nullptr) value_->Unref();
value_ = nullptr;
}
// TODO(roth): This method exists solely as a transition mechanism to allow // TODO(roth): This method exists solely as a transition mechanism to allow
// us to pass a ref to idiomatic C code that does not use RefCountedPtr<>. // us to pass a ref to idiomatic C code that does not use RefCountedPtr<>.
// Once all of our code has been converted to idiomatic C++, this // Once all of our code has been converted to idiomatic C++, this
@ -89,16 +128,34 @@ class RefCountedPtr {
T& operator*() const { return *value_; } T& operator*() const { return *value_; }
T* operator->() const { return value_; } T* operator->() const { return value_; }
bool operator==(const RefCountedPtr& other) const { template <typename Y>
bool operator==(const RefCountedPtr<Y>& other) const {
return value_ == other.value_; return value_ == other.value_;
} }
bool operator==(const T* other) const { return value_ == other; }
bool operator!=(const RefCountedPtr& other) const { template <typename Y>
bool operator==(const Y* other) const {
return value_ == other;
}
bool operator==(std::nullptr_t) const { return value_ == nullptr; }
template <typename Y>
bool operator!=(const RefCountedPtr<Y>& other) const {
return value_ != other.value_; return value_ != other.value_;
} }
bool operator!=(const T* other) const { return value_ != other; }
template <typename Y>
bool operator!=(const Y* other) const {
return value_ != other;
}
bool operator!=(std::nullptr_t) const { return value_ != nullptr; }
private: private:
template <typename Y>
friend class RefCountedPtr;
T* value_ = nullptr; T* value_ = nullptr;
}; };
@ -107,11 +164,6 @@ inline RefCountedPtr<T> MakeRefCounted(Args&&... args) {
return RefCountedPtr<T>(New<T>(std::forward<Args>(args)...)); return RefCountedPtr<T>(New<T>(std::forward<Args>(args)...));
} }
template <typename Parent, typename Child, typename... Args>
inline RefCountedPtr<Parent> MakePolymorphicRefCounted(Args&&... args) {
return RefCountedPtr<Parent>(New<Child>(std::forward<Args>(args)...));
}
} // namespace grpc_core } // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H */ #endif /* GRPC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H */

@ -140,10 +140,6 @@ struct grpc_fd {
struct grpc_fd* freelist_next; struct grpc_fd* freelist_next;
/* The pollset that last noticed that the fd is readable. The actual type
* stored in this is (grpc_pollset *) */
gpr_atm read_notifier_pollset;
grpc_iomgr_object iomgr_object; grpc_iomgr_object iomgr_object;
}; };
@ -293,7 +289,6 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
new_fd->read_closure->InitEvent(); new_fd->read_closure->InitEvent();
new_fd->write_closure->InitEvent(); new_fd->write_closure->InitEvent();
new_fd->error_closure->InitEvent(); new_fd->error_closure->InitEvent();
gpr_atm_no_barrier_store(&new_fd->read_notifier_pollset, (gpr_atm)NULL);
new_fd->freelist_next = nullptr; new_fd->freelist_next = nullptr;
@ -376,11 +371,6 @@ static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
gpr_mu_unlock(&fd_freelist_mu); gpr_mu_unlock(&fd_freelist_mu);
} }
static grpc_pollset* fd_get_read_notifier_pollset(grpc_fd* fd) {
gpr_atm notifier = gpr_atm_acq_load(&fd->read_notifier_pollset);
return (grpc_pollset*)notifier;
}
static bool fd_is_shutdown(grpc_fd* fd) { static bool fd_is_shutdown(grpc_fd* fd) {
return fd->read_closure->IsShutdown(); return fd->read_closure->IsShutdown();
} }
@ -397,11 +387,7 @@ static void fd_notify_on_error(grpc_fd* fd, grpc_closure* closure) {
fd->error_closure->NotifyOn(closure); fd->error_closure->NotifyOn(closure);
} }
static void fd_become_readable(grpc_fd* fd, grpc_pollset* notifier) { static void fd_become_readable(grpc_fd* fd) { fd->read_closure->SetReady(); }
fd->read_closure->SetReady();
/* Use release store to match with acquire load in fd_get_read_notifier */
gpr_atm_rel_store(&fd->read_notifier_pollset, (gpr_atm)notifier);
}
static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); } static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); }
@ -642,7 +628,7 @@ static grpc_error* process_epoll_events(grpc_pollset* pollset) {
} }
if (read_ev || cancel || err_fallback) { if (read_ev || cancel || err_fallback) {
fd_become_readable(fd, pollset); fd_become_readable(fd);
} }
if (write_ev || cancel || err_fallback) { if (write_ev || cancel || err_fallback) {
@ -1218,7 +1204,6 @@ static const grpc_event_engine_vtable vtable = {
fd_notify_on_write, fd_notify_on_write,
fd_notify_on_error, fd_notify_on_error,
fd_is_shutdown, fd_is_shutdown,
fd_get_read_notifier_pollset,
pollset_init, pollset_init,
pollset_shutdown, pollset_shutdown,

@ -135,7 +135,7 @@ struct pollable {
// underlying epoll set (i.e whenever fd_orphan() is called). // underlying epoll set (i.e whenever fd_orphan() is called).
// //
// Implementing (2) above (i.e removing fds from cache on fd_orphan) adds a // Implementing (2) above (i.e removing fds from cache on fd_orphan) adds a
// lot of complexity since an fd can be present in multiple pollalbles. So our // lot of complexity since an fd can be present in multiple pollables. So our
// implementation ONLY DOES (1) and NOT (2). // implementation ONLY DOES (1) and NOT (2).
// //
// The cache_fd.salt variable helps here to maintain correctness (it serves as // The cache_fd.salt variable helps here to maintain correctness (it serves as
@ -220,10 +220,6 @@ struct grpc_fd {
struct grpc_fd* freelist_next; struct grpc_fd* freelist_next;
grpc_closure* on_done_closure; grpc_closure* on_done_closure;
// The pollset that last noticed that the fd is readable. The actual type
// stored in this is (grpc_pollset *)
gpr_atm read_notifier_pollset;
grpc_iomgr_object iomgr_object; grpc_iomgr_object iomgr_object;
// Do we need to track EPOLLERR events separately? // Do we need to track EPOLLERR events separately?
@ -353,7 +349,6 @@ static void invalidate_fd(grpc_fd* fd) {
memset(&fd->pollable_mu, -1, sizeof(fd->pollable_mu)); memset(&fd->pollable_mu, -1, sizeof(fd->pollable_mu));
fd->pollable_obj = nullptr; fd->pollable_obj = nullptr;
fd->on_done_closure = nullptr; fd->on_done_closure = nullptr;
gpr_atm_no_barrier_store(&fd->read_notifier_pollset, 0);
memset(&fd->iomgr_object, -1, sizeof(fd->iomgr_object)); memset(&fd->iomgr_object, -1, sizeof(fd->iomgr_object));
fd->track_err = false; fd->track_err = false;
} }
@ -445,7 +440,6 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
new_fd->error_closure->InitEvent(); new_fd->error_closure->InitEvent();
new_fd->freelist_next = nullptr; new_fd->freelist_next = nullptr;
new_fd->on_done_closure = nullptr; new_fd->on_done_closure = nullptr;
gpr_atm_no_barrier_store(&new_fd->read_notifier_pollset, (gpr_atm)NULL);
char* fd_name; char* fd_name;
gpr_asprintf(&fd_name, "%s fd=%d", name, fd); gpr_asprintf(&fd_name, "%s fd=%d", name, fd);
@ -514,11 +508,6 @@ static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
UNREF_BY(fd, 2, reason); /* Drop the reference */ UNREF_BY(fd, 2, reason); /* Drop the reference */
} }
static grpc_pollset* fd_get_read_notifier_pollset(grpc_fd* fd) {
gpr_atm notifier = gpr_atm_acq_load(&fd->read_notifier_pollset);
return (grpc_pollset*)notifier;
}
static bool fd_is_shutdown(grpc_fd* fd) { static bool fd_is_shutdown(grpc_fd* fd) {
return fd->read_closure->IsShutdown(); return fd->read_closure->IsShutdown();
} }
@ -875,17 +864,7 @@ static int poll_deadline_to_millis_timeout(grpc_millis millis) {
return static_cast<int>(delta); return static_cast<int>(delta);
} }
static void fd_become_readable(grpc_fd* fd, grpc_pollset* notifier) { static void fd_become_readable(grpc_fd* fd) { fd->read_closure->SetReady(); }
fd->read_closure->SetReady();
/* Note, it is possible that fd_become_readable might be called twice with
different 'notifier's when an fd becomes readable and it is in two epoll
sets (This can happen briefly during polling island merges). In such cases
it does not really matter which notifer is set as the read_notifier_pollset
(They would both point to the same polling island anyway) */
/* Use release store to match with acquire load in fd_get_read_notifier */
gpr_atm_rel_store(&fd->read_notifier_pollset, (gpr_atm)notifier);
}
static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); } static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); }
@ -983,7 +962,7 @@ static grpc_error* pollable_process_events(grpc_pollset* pollset,
fd_has_errors(fd); fd_has_errors(fd);
} }
if (read_ev || cancel || err_fallback) { if (read_ev || cancel || err_fallback) {
fd_become_readable(fd, pollset); fd_become_readable(fd);
} }
if (write_ev || cancel || err_fallback) { if (write_ev || cancel || err_fallback) {
fd_become_writable(fd); fd_become_writable(fd);
@ -1637,7 +1616,6 @@ static const grpc_event_engine_vtable vtable = {
fd_notify_on_write, fd_notify_on_write,
fd_notify_on_error, fd_notify_on_error,
fd_is_shutdown, fd_is_shutdown,
fd_get_read_notifier_pollset,
pollset_init, pollset_init,
pollset_shutdown, pollset_shutdown,

@ -137,10 +137,6 @@ struct grpc_fd {
struct grpc_fd* freelist_next; struct grpc_fd* freelist_next;
grpc_closure* on_done_closure; grpc_closure* on_done_closure;
/* The pollset that last noticed that the fd is readable. The actual type
* stored in this is (grpc_pollset *) */
gpr_atm read_notifier_pollset;
grpc_iomgr_object iomgr_object; grpc_iomgr_object iomgr_object;
/* Do we need to track EPOLLERR events separately? */ /* Do we need to track EPOLLERR events separately? */
@ -845,7 +841,6 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
new_fd->write_closure->InitEvent(); new_fd->write_closure->InitEvent();
new_fd->error_closure->InitEvent(); new_fd->error_closure->InitEvent();
new_fd->track_err = track_err; new_fd->track_err = track_err;
gpr_atm_no_barrier_store(&new_fd->read_notifier_pollset, (gpr_atm)NULL);
new_fd->freelist_next = nullptr; new_fd->freelist_next = nullptr;
new_fd->on_done_closure = nullptr; new_fd->on_done_closure = nullptr;
@ -927,11 +922,6 @@ static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
GRPC_ERROR_UNREF(error); GRPC_ERROR_UNREF(error);
} }
static grpc_pollset* fd_get_read_notifier_pollset(grpc_fd* fd) {
gpr_atm notifier = gpr_atm_acq_load(&fd->read_notifier_pollset);
return (grpc_pollset*)notifier;
}
static bool fd_is_shutdown(grpc_fd* fd) { static bool fd_is_shutdown(grpc_fd* fd) {
return fd->read_closure->IsShutdown(); return fd->read_closure->IsShutdown();
} }
@ -1115,17 +1105,7 @@ static int poll_deadline_to_millis_timeout(grpc_millis millis) {
return static_cast<int>(delta); return static_cast<int>(delta);
} }
static void fd_become_readable(grpc_fd* fd, grpc_pollset* notifier) { static void fd_become_readable(grpc_fd* fd) { fd->read_closure->SetReady(); }
fd->read_closure->SetReady();
/* Note, it is possible that fd_become_readable might be called twice with
different 'notifier's when an fd becomes readable and it is in two epoll
sets (This can happen briefly during polling island merges). In such cases
it does not really matter which notifer is set as the read_notifier_pollset
(They would both point to the same polling island anyway) */
/* Use release store to match with acquire load in fd_get_read_notifier */
gpr_atm_rel_store(&fd->read_notifier_pollset, (gpr_atm)notifier);
}
static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); } static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); }
@ -1283,7 +1263,7 @@ static void pollset_work_and_unlock(grpc_pollset* pollset,
fd_has_errors(fd); fd_has_errors(fd);
} }
if (read_ev || cancel || err_fallback) { if (read_ev || cancel || err_fallback) {
fd_become_readable(fd, pollset); fd_become_readable(fd);
} }
if (write_ev || cancel || err_fallback) { if (write_ev || cancel || err_fallback) {
fd_become_writable(fd); fd_become_writable(fd);
@ -1668,7 +1648,6 @@ static const grpc_event_engine_vtable vtable = {
fd_notify_on_write, fd_notify_on_write,
fd_notify_on_error, fd_notify_on_error,
fd_is_shutdown, fd_is_shutdown,
fd_get_read_notifier_pollset,
pollset_init, pollset_init,
pollset_shutdown, pollset_shutdown,

@ -108,9 +108,6 @@ struct grpc_fd {
grpc_closure* on_done_closure; grpc_closure* on_done_closure;
grpc_iomgr_object iomgr_object; grpc_iomgr_object iomgr_object;
/* The pollset that last noticed and notified that the fd is readable */
grpc_pollset* read_notifier_pollset;
}; };
/* Begin polling on an fd. /* Begin polling on an fd.
@ -131,8 +128,7 @@ static uint32_t fd_begin_poll(grpc_fd* fd, grpc_pollset* pollset,
MUST NOT be called with a pollset lock taken MUST NOT be called with a pollset lock taken
if got_read or got_write are 1, also does the become_{readable,writable} as if got_read or got_write are 1, also does the become_{readable,writable} as
appropriate. */ appropriate. */
static void fd_end_poll(grpc_fd_watcher* rec, int got_read, int got_write, static void fd_end_poll(grpc_fd_watcher* rec, int got_read, int got_write);
grpc_pollset* read_notifier_pollset);
/* Return 1 if this fd is orphaned, 0 otherwise */ /* Return 1 if this fd is orphaned, 0 otherwise */
static bool fd_is_orphaned(grpc_fd* fd); static bool fd_is_orphaned(grpc_fd* fd);
@ -346,7 +342,6 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
r->closed = 0; r->closed = 0;
r->released = 0; r->released = 0;
gpr_atm_no_barrier_store(&r->pollhup, 0); gpr_atm_no_barrier_store(&r->pollhup, 0);
r->read_notifier_pollset = nullptr;
char* name2; char* name2;
gpr_asprintf(&name2, "%s fd=%d", name, fd); gpr_asprintf(&name2, "%s fd=%d", name, fd);
@ -359,17 +354,6 @@ static bool fd_is_orphaned(grpc_fd* fd) {
return (gpr_atm_acq_load(&fd->refst) & 1) == 0; return (gpr_atm_acq_load(&fd->refst) & 1) == 0;
} }
/* Return the read-notifier pollset */
static grpc_pollset* fd_get_read_notifier_pollset(grpc_fd* fd) {
grpc_pollset* notifier = nullptr;
gpr_mu_lock(&fd->mu);
notifier = fd->read_notifier_pollset;
gpr_mu_unlock(&fd->mu);
return notifier;
}
static grpc_error* pollset_kick_locked(grpc_fd_watcher* watcher) { static grpc_error* pollset_kick_locked(grpc_fd_watcher* watcher) {
gpr_mu_lock(&watcher->pollset->mu); gpr_mu_lock(&watcher->pollset->mu);
GPR_ASSERT(watcher->worker); GPR_ASSERT(watcher->worker);
@ -512,11 +496,6 @@ static int set_ready_locked(grpc_fd* fd, grpc_closure** st) {
} }
} }
static void set_read_notifier_pollset_locked(
grpc_fd* fd, grpc_pollset* read_notifier_pollset) {
fd->read_notifier_pollset = read_notifier_pollset;
}
static void fd_shutdown(grpc_fd* fd, grpc_error* why) { static void fd_shutdown(grpc_fd* fd, grpc_error* why) {
gpr_mu_lock(&fd->mu); gpr_mu_lock(&fd->mu);
/* only shutdown once */ /* only shutdown once */
@ -553,8 +532,10 @@ static void fd_notify_on_write(grpc_fd* fd, grpc_closure* closure) {
} }
static void fd_notify_on_error(grpc_fd* fd, grpc_closure* closure) { static void fd_notify_on_error(grpc_fd* fd, grpc_closure* closure) {
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors."); if (grpc_polling_trace.enabled()) {
abort(); gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
}
GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_CANCELLED);
} }
static uint32_t fd_begin_poll(grpc_fd* fd, grpc_pollset* pollset, static uint32_t fd_begin_poll(grpc_fd* fd, grpc_pollset* pollset,
@ -608,8 +589,7 @@ static uint32_t fd_begin_poll(grpc_fd* fd, grpc_pollset* pollset,
return mask; return mask;
} }
static void fd_end_poll(grpc_fd_watcher* watcher, int got_read, int got_write, static void fd_end_poll(grpc_fd_watcher* watcher, int got_read, int got_write) {
grpc_pollset* read_notifier_pollset) {
int was_polling = 0; int was_polling = 0;
int kick = 0; int kick = 0;
grpc_fd* fd = watcher->fd; grpc_fd* fd = watcher->fd;
@ -645,9 +625,6 @@ static void fd_end_poll(grpc_fd_watcher* watcher, int got_read, int got_write,
if (set_ready_locked(fd, &fd->read_closure)) { if (set_ready_locked(fd, &fd->read_closure)) {
kick = 1; kick = 1;
} }
if (read_notifier_pollset != nullptr) {
set_read_notifier_pollset_locked(fd, read_notifier_pollset);
}
} }
if (got_write) { if (got_write) {
if (set_ready_locked(fd, &fd->write_closure)) { if (set_ready_locked(fd, &fd->write_closure)) {
@ -997,16 +974,16 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
for (i = 1; i < pfd_count; i++) { for (i = 1; i < pfd_count; i++) {
if (watchers[i].fd == nullptr) { if (watchers[i].fd == nullptr) {
fd_end_poll(&watchers[i], 0, 0, nullptr); fd_end_poll(&watchers[i], 0, 0);
} else { } else {
// Wake up all the file descriptors, if we have an invalid one // Wake up all the file descriptors, if we have an invalid one
// we can identify it on the next pollset_work() // we can identify it on the next pollset_work()
fd_end_poll(&watchers[i], 1, 1, pollset); fd_end_poll(&watchers[i], 1, 1);
} }
} }
} else if (r == 0) { } else if (r == 0) {
for (i = 1; i < pfd_count; i++) { for (i = 1; i < pfd_count; i++) {
fd_end_poll(&watchers[i], 0, 0, nullptr); fd_end_poll(&watchers[i], 0, 0);
} }
} else { } else {
if (pfds[0].revents & POLLIN_CHECK) { if (pfds[0].revents & POLLIN_CHECK) {
@ -1018,7 +995,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
} }
for (i = 1; i < pfd_count; i++) { for (i = 1; i < pfd_count; i++) {
if (watchers[i].fd == nullptr) { if (watchers[i].fd == nullptr) {
fd_end_poll(&watchers[i], 0, 0, nullptr); fd_end_poll(&watchers[i], 0, 0);
} else { } else {
if (grpc_polling_trace.enabled()) { if (grpc_polling_trace.enabled()) {
gpr_log(GPR_INFO, "%p got_event: %d r:%d w:%d [%d]", pollset, gpr_log(GPR_INFO, "%p got_event: %d r:%d w:%d [%d]", pollset,
@ -1032,7 +1009,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
gpr_atm_no_barrier_store(&watchers[i].fd->pollhup, 1); gpr_atm_no_barrier_store(&watchers[i].fd->pollhup, 1);
} }
fd_end_poll(&watchers[i], pfds[i].revents & POLLIN_CHECK, fd_end_poll(&watchers[i], pfds[i].revents & POLLIN_CHECK,
pfds[i].revents & POLLOUT_CHECK, pollset); pfds[i].revents & POLLOUT_CHECK);
} }
} }
} }
@ -1724,7 +1701,6 @@ static const grpc_event_engine_vtable vtable = {
fd_notify_on_write, fd_notify_on_write,
fd_notify_on_error, fd_notify_on_error,
fd_is_shutdown, fd_is_shutdown,
fd_get_read_notifier_pollset,
pollset_init, pollset_init,
pollset_shutdown, pollset_shutdown,

@ -52,7 +52,6 @@ typedef struct grpc_event_engine_vtable {
void (*fd_notify_on_write)(grpc_fd* fd, grpc_closure* closure); void (*fd_notify_on_write)(grpc_fd* fd, grpc_closure* closure);
void (*fd_notify_on_error)(grpc_fd* fd, grpc_closure* closure); void (*fd_notify_on_error)(grpc_fd* fd, grpc_closure* closure);
bool (*fd_is_shutdown)(grpc_fd* fd); bool (*fd_is_shutdown)(grpc_fd* fd);
grpc_pollset* (*fd_get_read_notifier_pollset)(grpc_fd* fd);
void (*pollset_init)(grpc_pollset* pollset, gpr_mu** mu); void (*pollset_init)(grpc_pollset* pollset, gpr_mu** mu);
void (*pollset_shutdown)(grpc_pollset* pollset, grpc_closure* closure); void (*pollset_shutdown)(grpc_pollset* pollset, grpc_closure* closure);
@ -142,9 +141,6 @@ void grpc_fd_notify_on_write(grpc_fd* fd, grpc_closure* closure);
* needs to have been set on grpc_fd_create */ * needs to have been set on grpc_fd_create */
void grpc_fd_notify_on_error(grpc_fd* fd, grpc_closure* closure); void grpc_fd_notify_on_error(grpc_fd* fd, grpc_closure* closure);
/* Return the read notifier pollset from the fd */
grpc_pollset* grpc_fd_get_read_notifier_pollset(grpc_fd* fd);
/* pollset_posix functions */ /* pollset_posix functions */
/* Add an fd to a pollset */ /* Add an fd to a pollset */

@ -107,6 +107,13 @@ std::shared_ptr<ChannelCredentials> AltsCredentials(
return WrapChannelCredentials(c_creds); return WrapChannelCredentials(c_creds);
} }
// Builds Local Credentials
std::shared_ptr<ChannelCredentials> LocalCredentials(
grpc_local_connect_type type) {
GrpcLibraryCodegen init; // To call grpc_init().
return WrapChannelCredentials(grpc_local_credentials_create(type));
}
} // namespace experimental } // namespace experimental
// Builds credentials for use when running in GCE // Builds credentials for use when running in GCE

@ -139,5 +139,11 @@ std::shared_ptr<ServerCredentials> AltsServerCredentials(
new SecureServerCredentials(c_creds)); new SecureServerCredentials(c_creds));
} }
std::shared_ptr<ServerCredentials> LocalServerCredentials(
grpc_local_connect_type type) {
return std::shared_ptr<ServerCredentials>(
new SecureServerCredentials(grpc_local_server_credentials_create(type)));
}
} // namespace experimental } // namespace experimental
} // namespace grpc } // namespace grpc

@ -43,7 +43,7 @@ xcodebuild \
-workspace *.xcworkspace \ -workspace *.xcworkspace \
-scheme $SCHEME \ -scheme $SCHEME \
-destination generic/platform=iOS \ -destination generic/platform=iOS \
-derivedDataPath Build \ -derivedDataPath Build/Build \
CODE_SIGN_IDENTITY="" \ CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \ CODE_SIGNING_REQUIRED=NO \
| egrep -v "$XCODEBUILD_FILTER" \ | egrep -v "$XCODEBUILD_FILTER" \

@ -17,11 +17,13 @@ import threading
import grpc import grpc
from grpc_health.v1 import health_pb2 from grpc_health.v1 import health_pb2 as _health_pb2
from grpc_health.v1 import health_pb2_grpc from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc
SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name
class HealthServicer(health_pb2_grpc.HealthServicer):
class HealthServicer(_health_pb2_grpc.HealthServicer):
"""Servicer handling RPCs for service statuses.""" """Servicer handling RPCs for service statuses."""
def __init__(self): def __init__(self):
@ -33,9 +35,9 @@ class HealthServicer(health_pb2_grpc.HealthServicer):
status = self._server_status.get(request.service) status = self._server_status.get(request.service)
if status is None: if status is None:
context.set_code(grpc.StatusCode.NOT_FOUND) context.set_code(grpc.StatusCode.NOT_FOUND)
return health_pb2.HealthCheckResponse() return _health_pb2.HealthCheckResponse()
else: else:
return health_pb2.HealthCheckResponse(status=status) return _health_pb2.HealthCheckResponse(status=status)
def set(self, service, status): def set(self, service, status):
"""Sets the status of a service. """Sets the status of a service.

@ -17,15 +17,17 @@ import grpc
from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pb2
from google.protobuf import descriptor_pool from google.protobuf import descriptor_pool
from grpc_reflection.v1alpha import reflection_pb2 from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2
from grpc_reflection.v1alpha import reflection_pb2_grpc from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc
_POOL = descriptor_pool.Default() _POOL = descriptor_pool.Default()
SERVICE_NAME = _reflection_pb2.DESCRIPTOR.services_by_name[
'ServerReflection'].full_name
def _not_found_error(): def _not_found_error():
return reflection_pb2.ServerReflectionResponse( return _reflection_pb2.ServerReflectionResponse(
error_response=reflection_pb2.ErrorResponse( error_response=_reflection_pb2.ErrorResponse(
error_code=grpc.StatusCode.NOT_FOUND.value[0], error_code=grpc.StatusCode.NOT_FOUND.value[0],
error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(), error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
)) ))
@ -35,12 +37,12 @@ def _file_descriptor_response(descriptor):
proto = descriptor_pb2.FileDescriptorProto() proto = descriptor_pb2.FileDescriptorProto()
descriptor.CopyToProto(proto) descriptor.CopyToProto(proto)
serialized_proto = proto.SerializeToString() serialized_proto = proto.SerializeToString()
return reflection_pb2.ServerReflectionResponse( return _reflection_pb2.ServerReflectionResponse(
file_descriptor_response=reflection_pb2.FileDescriptorResponse( file_descriptor_response=_reflection_pb2.FileDescriptorResponse(
file_descriptor_proto=(serialized_proto,)),) file_descriptor_proto=(serialized_proto,)),)
class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer): class ReflectionServicer(_reflection_pb2_grpc.ServerReflectionServicer):
"""Servicer handling RPCs for service statuses.""" """Servicer handling RPCs for service statuses."""
def __init__(self, service_names, pool=None): def __init__(self, service_names, pool=None):
@ -94,17 +96,17 @@ class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer):
except KeyError: except KeyError:
return _not_found_error() return _not_found_error()
else: else:
return reflection_pb2.ServerReflectionResponse( return _reflection_pb2.ServerReflectionResponse(
all_extension_numbers_response=reflection_pb2. all_extension_numbers_response=_reflection_pb2.
ExtensionNumberResponse( ExtensionNumberResponse(
base_type_name=message_descriptor.full_name, base_type_name=message_descriptor.full_name,
extension_number=extension_numbers)) extension_number=extension_numbers))
def _list_services(self): def _list_services(self):
return reflection_pb2.ServerReflectionResponse( return _reflection_pb2.ServerReflectionResponse(
list_services_response=reflection_pb2.ListServiceResponse( list_services_response=_reflection_pb2.ListServiceResponse(
service=[ service=[
reflection_pb2.ServiceResponse(name=service_name) _reflection_pb2.ServiceResponse(name=service_name)
for service_name in self._service_names for service_name in self._service_names
])) ]))
@ -126,8 +128,8 @@ class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer):
elif request.HasField('list_services'): elif request.HasField('list_services'):
yield self._list_services() yield self._list_services()
else: else:
yield reflection_pb2.ServerReflectionResponse( yield _reflection_pb2.ServerReflectionResponse(
error_response=reflection_pb2.ErrorResponse( error_response=_reflection_pb2.ErrorResponse(
error_code=grpc.StatusCode.INVALID_ARGUMENT.value[0], error_code=grpc.StatusCode.INVALID_ARGUMENT.value[0],
error_message=grpc.StatusCode.INVALID_ARGUMENT.value[1] error_message=grpc.StatusCode.INVALID_ARGUMENT.value[1]
.encode(), .encode(),
@ -142,5 +144,5 @@ def enable_server_reflection(service_names, server, pool=None):
server: grpc.Server to which reflection service will be added. server: grpc.Server to which reflection service will be added.
pool: DescriptorPool object to use (descriptor_pool.Default() if None). pool: DescriptorPool object to use (descriptor_pool.Default() if None).
""" """
reflection_pb2_grpc.add_ServerReflectionServicer_to_server( _reflection_pb2_grpc.add_ServerReflectionServicer_to_server(
ReflectionServicer(service_names, pool=pool), server) ReflectionServicer(service_names, pool=pool), server)

@ -73,6 +73,9 @@ class HealthServicerTest(unittest.TestCase):
self.assertEqual(grpc.StatusCode.NOT_FOUND, context.exception.code()) self.assertEqual(grpc.StatusCode.NOT_FOUND, context.exception.code())
def test_health_service_name(self):
self.assertEqual(health.SERVICE_NAME, 'grpc.health.v1.Health')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(verbosity=2) unittest.main(verbosity=2)

@ -171,6 +171,10 @@ class ReflectionServicerTest(unittest.TestCase):
for name in _SERVICE_NAMES))),) for name in _SERVICE_NAMES))),)
self.assertSequenceEqual(expected_responses, responses) self.assertSequenceEqual(expected_responses, responses)
def testReflectionServiceName(self):
self.assertEqual(reflection.SERVICE_NAME,
'grpc.reflection.v1alpha.ServerReflection')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(verbosity=2) unittest.main(verbosity=2)

@ -15,31 +15,6 @@
require 'etc' require 'etc'
require 'mkmf' require 'mkmf'
LIBDIR = RbConfig::CONFIG['libdir']
INCLUDEDIR = RbConfig::CONFIG['includedir']
HEADER_DIRS = [
# Search /opt/local (Mac source install)
'/opt/local/include',
# Search /usr/local (Source install)
'/usr/local/include',
# Check the ruby install locations
INCLUDEDIR
]
LIB_DIRS = [
# Search /opt/local (Mac source install)
'/opt/local/lib',
# Search /usr/local (Source install)
'/usr/local/lib',
# Check the ruby install locations
LIBDIR
]
windows = RUBY_PLATFORM =~ /mingw|mswin/ windows = RUBY_PLATFORM =~ /mingw|mswin/
bsd = RUBY_PLATFORM =~ /bsd/ bsd = RUBY_PLATFORM =~ /bsd/

@ -187,8 +187,8 @@ TEST_P(ChannelTracerTest, ComplexTest) {
AddSimpleTrace(&tracer); AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer); AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer); AddSimpleTrace(&tracer);
sc1.reset(nullptr); sc1.reset();
sc2.reset(nullptr); sc2.reset();
} }
// Test a case in which the parent channel has subchannels and the subchannels // Test a case in which the parent channel has subchannels and the subchannels
@ -234,9 +234,9 @@ TEST_P(ChannelTracerTest, TestNesting) {
grpc_slice_from_static_string("subchannel one inactive"), sc1); grpc_slice_from_static_string("subchannel one inactive"), sc1);
AddSimpleTrace(&tracer); AddSimpleTrace(&tracer);
ValidateChannelTrace(&tracer, 8, GetParam()); ValidateChannelTrace(&tracer, 8, GetParam());
sc1.reset(nullptr); sc1.reset();
sc2.reset(nullptr); sc2.reset();
conn1.reset(nullptr); conn1.reset();
} }
INSTANTIATE_TEST_CASE_P(ChannelTracerTestSweep, ChannelTracerTest, INSTANTIATE_TEST_CASE_P(ChannelTracerTestSweep, ChannelTracerTest,

@ -127,7 +127,7 @@ TEST(RefCountedPtr, ResetFromNonNullToNull) {
TEST(RefCountedPtr, ResetFromNullToNull) { TEST(RefCountedPtr, ResetFromNullToNull) {
RefCountedPtr<Foo> foo; RefCountedPtr<Foo> foo;
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
foo.reset(nullptr); foo.reset();
EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo.get());
} }
@ -175,6 +175,67 @@ TEST(RefCountedPtr, RefCountedWithTracing) {
foo->Unref(DEBUG_LOCATION, "foo"); foo->Unref(DEBUG_LOCATION, "foo");
} }
class BaseClass : public RefCounted<BaseClass> {
public:
BaseClass() {}
};
class Subclass : public BaseClass {
public:
Subclass() {}
};
TEST(RefCountedPtr, ConstructFromSubclass) {
RefCountedPtr<BaseClass> p(New<Subclass>());
}
TEST(RefCountedPtr, CopyAssignFromSubclass) {
RefCountedPtr<BaseClass> b;
EXPECT_EQ(nullptr, b.get());
RefCountedPtr<Subclass> s = MakeRefCounted<Subclass>();
b = s;
EXPECT_NE(nullptr, b.get());
}
TEST(RefCountedPtr, MoveAssignFromSubclass) {
RefCountedPtr<BaseClass> b;
EXPECT_EQ(nullptr, b.get());
RefCountedPtr<Subclass> s = MakeRefCounted<Subclass>();
b = std::move(s);
EXPECT_NE(nullptr, b.get());
}
TEST(RefCountedPtr, ResetFromSubclass) {
RefCountedPtr<BaseClass> b;
EXPECT_EQ(nullptr, b.get());
b.reset(New<Subclass>());
EXPECT_NE(nullptr, b.get());
}
TEST(RefCountedPtr, EqualityWithSubclass) {
Subclass* s = New<Subclass>();
RefCountedPtr<BaseClass> b(s);
EXPECT_EQ(b, s);
}
void FunctionTakingBaseClass(RefCountedPtr<BaseClass> p) {
p.reset(); // To appease clang-tidy.
}
TEST(RefCountedPtr, CanPassSubclassToFunctionExpectingBaseClass) {
RefCountedPtr<Subclass> p = MakeRefCounted<Subclass>();
FunctionTakingBaseClass(p);
}
void FunctionTakingSubclass(RefCountedPtr<Subclass> p) {
p.reset(); // To appease clang-tidy.
}
TEST(RefCountedPtr, CanPassSubclassToFunctionExpectingSubclass) {
RefCountedPtr<Subclass> p = MakeRefCounted<Subclass>();
FunctionTakingSubclass(p);
}
} // namespace } // namespace
} // namespace testing } // namespace testing
} // namespace grpc_core } // namespace grpc_core

@ -19,6 +19,8 @@
#ifndef TEST_QPS_CLIENT_H #ifndef TEST_QPS_CLIENT_H
#define TEST_QPS_CLIENT_H #define TEST_QPS_CLIENT_H
#include <stdlib.h>
#include <condition_variable> #include <condition_variable>
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
@ -34,6 +36,7 @@
#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h" #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "src/proto/grpc/testing/payloads.pb.h" #include "src/proto/grpc/testing/payloads.pb.h"
#include "src/core/lib/gpr/env.h"
#include "src/cpp/util/core_stats.h" #include "src/cpp/util/core_stats.h"
#include "test/cpp/qps/histogram.h" #include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/interarrival.h" #include "test/cpp/qps/interarrival.h"
@ -441,9 +444,24 @@ class ClientImpl : public Client {
std::unique_ptr<std::thread> WaitForReady() { std::unique_ptr<std::thread> WaitForReady() {
return std::unique_ptr<std::thread>(new std::thread([this]() { return std::unique_ptr<std::thread>(new std::thread([this]() {
if (!is_inproc_) { if (!is_inproc_) {
GPR_ASSERT(channel_->WaitForConnected( int connect_deadline = 10;
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), /* Allow optionally overriding connect_deadline in order
gpr_time_from_seconds(10, GPR_TIMESPAN)))); * to deal with benchmark environments in which the server
* can take a long time to become ready. */
char* channel_connect_timeout_str =
gpr_getenv("QPS_WORKER_CHANNEL_CONNECT_TIMEOUT");
if (channel_connect_timeout_str != nullptr &&
strcmp(channel_connect_timeout_str, "") != 0) {
connect_deadline = atoi(channel_connect_timeout_str);
}
gpr_log(GPR_INFO,
"Waiting for up to %d seconds for the channel %p to connect",
connect_deadline, channel_.get());
gpr_free(channel_connect_timeout_str);
GPR_ASSERT(channel_->WaitForConnected(gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_seconds(connect_deadline, GPR_TIMESPAN))));
gpr_log(GPR_INFO, "Channel %p connected!", channel_.get());
} }
})); }));
} }

@ -89,3 +89,7 @@ export DOTNET_CLI_TELEMETRY_OPTOUT=true
date date
git submodule update --init git submodule update --init
# Store intermediate build files of ios binary size test into /tmpfs
mkdir /tmpfs/Build-ios-binary-size
ln -s /tmpfs/Build-ios-binary-size src/objective-c/examples/Sample/Build

@ -55,7 +55,7 @@ def dir_size(dir):
def get_size(where, frameworks): def get_size(where, frameworks):
build_dir = 'src/objective-c/examples/Sample/Build-%s/' % where build_dir = 'src/objective-c/examples/Sample/Build/Build-%s/' % where
if not frameworks: if not frameworks:
link_map_filename = 'Build/Intermediates.noindex/Sample.build/Release-iphoneos/Sample.build/Sample-LinkMap-normal-arm64.txt' link_map_filename = 'Build/Intermediates.noindex/Sample.build/Release-iphoneos/Sample.build/Sample-LinkMap-normal-arm64.txt'
return parse_link_map(build_dir + link_map_filename) return parse_link_map(build_dir + link_map_filename)
@ -76,14 +76,15 @@ def get_size(where, frameworks):
def build(where, frameworks): def build(where, frameworks):
shutil.rmtree( shutil.rmtree(
'src/objective-c/examples/Sample/Build-%s' % where, ignore_errors=True) 'src/objective-c/examples/Sample/Build/Build-%s' % where,
ignore_errors=True)
subprocess.check_call( subprocess.check_call(
'CONFIG=opt EXAMPLE_PATH=src/objective-c/examples/Sample SCHEME=Sample FRAMEWORKS=%s ./build_one_example.sh' 'CONFIG=opt EXAMPLE_PATH=src/objective-c/examples/Sample SCHEME=Sample FRAMEWORKS=%s ./build_one_example.sh'
% ('YES' if frameworks else 'NO'), % ('YES' if frameworks else 'NO'),
shell=True, shell=True,
cwd='src/objective-c/tests') cwd='src/objective-c/tests')
os.rename('src/objective-c/examples/Sample/Build', os.rename('src/objective-c/examples/Sample/Build/Build',
'src/objective-c/examples/Sample/Build-%s' % where) 'src/objective-c/examples/Sample/Build/Build-%s' % where)
text = 'Objective-C binary sizes\n' text = 'Objective-C binary sizes\n'

@ -104,3 +104,31 @@ Example memory profile of grpc-go server, with `go tools pprof`:
``` ```
$ go tool pprof --text --alloc_space http://localhost:<pprof_port>/debug/heap $ go tool pprof --text --alloc_space http://localhost:<pprof_port>/debug/heap
``` ```
### Configuration environment variables:
* QPS_WORKER_CHANNEL_CONNECT_TIMEOUT
Consuming process: qps_worker
Type: integer (number of seconds)
This can be used to configure the amount of time that benchmark
clients wait for channels to the benchmark server to become ready.
This is useful in certain benchmark environments in which the
server can take a long time to become ready. Note: if setting
this to a high value, then the scenario config under test should
probably also have a large "warmup_seconds".
* QPS_WORKERS
Consuming process: qps_json_driver
Type: comma separated list of host:port
Set this to a comma separated list of QPS worker processes/machines.
Each scenario in a scenario config has specifies a certain number
of servers, `num_servers`, and the driver will start
"benchmark servers"'s on the first `num_server` `host:port` pairs in
the comma separated list. The rest will be told to run as clients
against the benchmark server.

Loading…
Cancel
Save