Skip to content
Snippets Groups Projects
Commit bee9325d authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

Make sure full method name starts with slash

parent 4491fbd0
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ namespace Grpc.Core
public Call(string serviceName, Method<TRequest, TResponse> method, Channel channel, Metadata headers)
{
this.name = Preconditions.CheckNotNull(serviceName) + "/" + method.Name;
this.name = method.GetFullName(serviceName);
this.requestMarshaller = method.RequestMarshaller;
this.responseMarshaller = method.ResponseMarshaller;
this.channel = Preconditions.CheckNotNull(channel);
......
......@@ -32,6 +32,7 @@
#endregion
using System;
using Grpc.Core.Utils;
namespace Grpc.Core
{
......@@ -95,5 +96,13 @@ namespace Grpc.Core
return this.responseMarshaller;
}
}
/// <summary>
/// Gets full name of the method including the service name.
/// </summary>
internal string GetFullName(string serviceName)
{
return "/" + Preconditions.CheckNotNull(serviceName) + "/" + this.Name;
}
}
}
......@@ -79,7 +79,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryCall(method, handler));
callHandlers.Add(method.GetFullName(serviceName), ServerCalls.UnaryCall(method, handler));
return this;
}
......@@ -89,7 +89,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ClientStreamingCall(method, handler));
callHandlers.Add(method.GetFullName(serviceName), ServerCalls.ClientStreamingCall(method, handler));
return this;
}
......@@ -99,7 +99,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ServerStreamingCall(method, handler));
callHandlers.Add(method.GetFullName(serviceName), ServerCalls.ServerStreamingCall(method, handler));
return this;
}
......@@ -109,7 +109,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.DuplexStreamingCall(method, handler));
callHandlers.Add(method.GetFullName(serviceName), ServerCalls.DuplexStreamingCall(method, handler));
return this;
}
......@@ -117,11 +117,6 @@ namespace Grpc.Core
{
return new ServerServiceDefinition(callHandlers.ToImmutableDictionary());
}
private string GetFullMethodName(string serviceName, string methodName)
{
return serviceName + "/" + methodName;
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment