Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Examples/Echo/Generated/echo.grpc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension Echo_EchoProvider {

/// Determines, calls and returns the appropriate request handler, depending on the request's method.
/// Returns nil for methods not handled by this service.
internal func handleMethod(_ methodName: String, request: HTTPRequestHead, serverHandler: GRPCChannelHandler, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
internal func handleMethod(_ methodName: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
switch methodName {
case "Get":
return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
Expand Down
2 changes: 1 addition & 1 deletion Sources/Examples/Echo/RUNME
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
#
protoc echo.proto \
--swift_out=Generated \
--swiftgrpc_out=Client=false,Server=true,NIO=true:Generated
--swiftgrpc_out=Client=true,Server=true:Generated
4 changes: 2 additions & 2 deletions Sources/GRPC/GRPCChannelHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public protocol CallHandlerProvider: class {

/// Determines, calls and returns the appropriate request handler (`GRPCCallHandler`), depending on the request's
/// method. Returns nil for methods not handled by this service.
func handleMethod(_ methodName: String, request: HTTPRequestHead, serverHandler: GRPCChannelHandler, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler?
func handleMethod(_ methodName: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler?
}

/// Listens on a newly-opened HTTP2 subchannel and yields to the sub-handler matching a call, if available.
Expand Down Expand Up @@ -107,7 +107,7 @@ extension GRPCChannelHandler: ChannelInboundHandler, RemovableChannelHandler {
let uriComponents = requestHead.uri.components(separatedBy: "/")
guard uriComponents.count >= 3 && uriComponents[0].isEmpty,
let providerForServiceName = servicesByName[uriComponents[1]],
let callHandler = providerForServiceName.handleMethod(uriComponents[2], request: requestHead, serverHandler: self, channel: channel, errorDelegate: errorDelegate) else {
let callHandler = providerForServiceName.handleMethod(uriComponents[2], request: requestHead, channel: channel, errorDelegate: errorDelegate) else {
return nil
}
return callHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ extension Grpc_Testing_TestServiceProvider {

/// Determines, calls and returns the appropriate request handler, depending on the request's method.
/// Returns nil for methods not handled by this service.
public func handleMethod(_ methodName: String, request: HTTPRequestHead, serverHandler: GRPCChannelHandler, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
public func handleMethod(_ methodName: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
switch methodName {
case "EmptyCall":
return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
Expand Down Expand Up @@ -318,7 +318,7 @@ extension Grpc_Testing_UnimplementedServiceProvider {

/// Determines, calls and returns the appropriate request handler, depending on the request's method.
/// Returns nil for methods not handled by this service.
public func handleMethod(_ methodName: String, request: HTTPRequestHead, serverHandler: GRPCChannelHandler, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
public func handleMethod(_ methodName: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
switch methodName {
case "UnimplementedCall":
return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
Expand All @@ -343,7 +343,7 @@ extension Grpc_Testing_ReconnectServiceProvider {

/// Determines, calls and returns the appropriate request handler, depending on the request's method.
/// Returns nil for methods not handled by this service.
public func handleMethod(_ methodName: String, request: HTTPRequestHead, serverHandler: GRPCChannelHandler, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
public func handleMethod(_ methodName: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
switch methodName {
case "Start":
return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
Expand Down
2 changes: 1 addition & 1 deletion Sources/protoc-gen-swiftgrpc/Generator-Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension Generator {
println()
println("/// Determines, calls and returns the appropriate request handler, depending on the request's method.")
println("/// Returns nil for methods not handled by this service.")
println("\(access) func handleMethod(_ methodName: String, request: HTTPRequestHead, serverHandler: GRPCChannelHandler, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {")
println("\(access) func handleMethod(_ methodName: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {")
indent()
println("switch methodName {")
for method in service.methods {
Expand Down