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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ add_library(
experimental/rsocket-src/transports/TcpConnectionAcceptor.cpp
experimental/rsocket/transports/TcpConnectionFactory.h
experimental/rsocket-src/transports/TcpConnectionFactory.cpp
experimental/rsocket/RSocketRequestHandler.h
experimental/rsocket/RSocketResponder.h
experimental/rsocket/RSocketConnectionHandler.h
experimental/rsocket-src/RSocketConnectionHandler.cpp
)
Expand Down
2 changes: 1 addition & 1 deletion examples/channel-hello-world/ChannelHelloWorld_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace yarpl::flowable;

DEFINE_int32(port, 9898, "port to connect to");

class HelloChannelRequestHandler : public rsocket::RSocketRequestHandler {
class HelloChannelRequestHandler : public rsocket::RSocketResponder {
public:
/// Handles a new inbound Stream requested by the other end.
yarpl::Reference<Flowable<reactivesocket::Payload>> handleRequestChannel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) {
// start accepting connections
rs->startAndPark(
[textHandler, jsonHandler](std::shared_ptr<ConnectionSetupRequest> r)
-> std::shared_ptr<RSocketRequestHandler> {
-> std::shared_ptr<RSocketResponder> {
if (r->getDataMimeType() == "text/plain") {
LOG(INFO) << "Connection Request => text/plain MimeType";
return textHandler;
Expand Down
2 changes: 1 addition & 1 deletion examples/conditional-request-handling/JsonRequestHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "rsocket/RSocket.h"
#include "src/Payload.h"

class JsonRequestHandler : public rsocket::RSocketRequestHandler {
class JsonRequestHandler : public rsocket::RSocketResponder {
public:
/// Handles a new inbound Stream requested by the other end.
yarpl::Reference<yarpl::flowable::Flowable<reactivesocket::Payload>>
Expand Down
2 changes: 1 addition & 1 deletion examples/conditional-request-handling/TextRequestHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "src/Payload.h"
#include "rsocket/RSocket.h"

class TextRequestHandler : public rsocket::RSocketRequestHandler {
class TextRequestHandler : public rsocket::RSocketResponder {
public:
/// Handles a new inbound Stream requested by the other end.
yarpl::Reference<yarpl::flowable::Flowable<reactivesocket::Payload>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using namespace yarpl::single;
DEFINE_int32(port, 9898, "port to connect to");

class HelloRequestResponseRequestHandler
: public rsocket::RSocketRequestHandler {
: public rsocket::RSocketResponder {
public:
Reference<Single<Payload>> handleRequestResponse(
Payload request,
Expand Down
2 changes: 1 addition & 1 deletion examples/stream-hello-world/StreamHelloWorld_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace yarpl::flowable;

DEFINE_int32(port, 9898, "port to connect to");

class HelloStreamRequestHandler : public rsocket::RSocketRequestHandler {
class HelloStreamRequestHandler : public rsocket::RSocketResponder {
public:
/// Handles a new inbound Stream requested by the other end.
yarpl::Reference<Flowable<reactivesocket::Payload>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using namespace yarpl::observable;

DEFINE_int32(port, 9898, "port to connect to");

class PushStreamRequestHandler : public rsocket::RSocketRequestHandler {
class PushStreamRequestHandler : public rsocket::RSocketResponder {
public:
/// Handles a new inbound Stream requested by the other end.
yarpl::Reference<Flowable<Payload>> handleRequestStream(
Expand Down
6 changes: 3 additions & 3 deletions experimental/rsocket-src/RSocketConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace reactivesocket;

class RSocketHandlerBridge : public reactivesocket::DefaultRequestHandler {
public:
RSocketHandlerBridge(std::shared_ptr<RSocketRequestHandler> handler)
RSocketHandlerBridge(std::shared_ptr<RSocketResponder> handler)
: handler_(std::move(handler)){};

void handleRequestStream(
Expand Down Expand Up @@ -107,7 +107,7 @@ class RSocketHandlerBridge : public reactivesocket::DefaultRequestHandler {
}

private:
std::shared_ptr<RSocketRequestHandler> handler_;
std::shared_ptr<RSocketResponder> handler_;
};

void RSocketConnectionHandler::setupNewSocket(
Expand All @@ -122,7 +122,7 @@ void RSocketConnectionHandler::setupNewSocket(
SocketParameters(setupPayload.resumable, setupPayload.protocolVersion);
std::shared_ptr<ConnectionSetupRequest> setupRequest =
std::make_shared<ConnectionSetupRequest>(std::move(setupPayload));
std::shared_ptr<RSocketRequestHandler> requestHandler;
std::shared_ptr<RSocketResponder> requestHandler;
try {
requestHandler = getHandler(setupRequest);
} catch (const RSocketError& e) {
Expand Down
2 changes: 1 addition & 1 deletion experimental/rsocket-src/RSocketServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RSocketServerConnectionHandler : public virtual RSocketConnectionHandler {
onAccept_ = onAccept;
}

std::shared_ptr<RSocketRequestHandler> getHandler(
std::shared_ptr<RSocketResponder> getHandler(
std::shared_ptr<ConnectionSetupRequest> request) override {
return onAccept_(std::move(request));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include <folly/ExceptionWrapper.h>
#include "rsocket/RSocketRequestHandler.h"
#include "rsocket/RSocketResponder.h"
#include "src/NullRequestHandler.h"
#include "src/Payload.h"
#include "src/ReactiveStreamsCompat.h"
Expand All @@ -13,7 +13,7 @@
namespace rsocket {
namespace tests {

class HelloStreamRequestHandler : public RSocketRequestHandler {
class HelloStreamRequestHandler : public RSocketResponder {
public:
/// Handles a new inbound Stream requested by the other end.
yarpl::Reference<yarpl::flowable::Flowable<reactivesocket::Payload>>
Expand Down
6 changes: 3 additions & 3 deletions experimental/rsocket/RSocketConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "rsocket/ConnectionResumeRequest.h"
#include "rsocket/ConnectionSetupRequest.h"
#include "rsocket/RSocketRequestHandler.h"
#include "rsocket/RSocketResponder.h"
#include "src/FrameTransport.h"
#include "src/ServerConnectionAcceptor.h"

Expand Down Expand Up @@ -36,11 +36,11 @@ class RSocketConnectionHandler : public reactivesocket::ConnectionHandler {

private:
/**
* An RSocketRequestHandler is responsible for translating a request stream
* An RSocketResponder is responsible for translating a request stream
* into action. This function provides the appropriate request handler for
* an RSocket given the setup of the socket.
*/
virtual std::shared_ptr<RSocketRequestHandler> getHandler(
virtual std::shared_ptr<RSocketResponder> getHandler(
std::shared_ptr<ConnectionSetupRequest> request) = 0;

/**
Expand Down
13 changes: 13 additions & 0 deletions experimental/rsocket/RSocketRequester.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ namespace rsocket {
*
* This is most commonly used by an RSocketClient, but due to the symmetric
* nature of RSocket, this can be used from server->client as well.
*
* For context within the overall RSocket protocol:
*
* - Client: The side initiating a connection.
* - Server: The side accepting connections from clients.
* - Connection: The instance of a transport session between client and server.
* - Requester: The side sending a request.
* A connection has at most 2 Requesters. One in each direction.
* - Responder: The side receiving a request.
* A connection has at most 2 Responders. One in each direction.
*
* See https://github.com/rsocket/rsocket/blob/master/Protocol.md#terminology
* for more information on how this fits into the RSocket protocol terminology.
*/
class RSocketRequester {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,27 @@
namespace rsocket {

/**
* RequestHandler APIs to handle requests on an RSocket connection.
* Responder APIs to handle requests on an RSocket connection.
*
* This is most commonly used by an RSocketServer, but due to the symmetric
* nature of RSocket, this can be used on the client as well.
*
* For context within the overall RSocket protocol:
*
* - Client: The side initiating a connection.
* - Server: The side accepting connections from clients.
* - Connection: The instance of a transport session between client and server.
* - Requester: The side sending a request.
* A connection has at most 2 Requesters. One in each direction.
* - Responder: The side receiving a request.
* A connection has at most 2 Responders. One in each direction.
*
* See https://github.com/rsocket/rsocket/blob/master/Protocol.md#terminology
* for more information on how this fits into the RSocket protocol terminology.
*/
class RSocketRequestHandler {
class RSocketResponder {
public:
virtual ~RSocketRequestHandler() {}
virtual ~RSocketResponder() {}

/**
* Called when a new `requestResponse` occurs from an RSocketRequester.
Expand Down
4 changes: 2 additions & 2 deletions experimental/rsocket/RSocketServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

#include "rsocket/ConnectionAcceptor.h"
#include "rsocket/ConnectionSetupRequest.h"
#include "rsocket/RSocketRequestHandler.h"
#include "rsocket/RSocketResponder.h"
#include "src/ReactiveSocket.h"
#include "src/ServerConnectionAcceptor.h"

namespace rsocket {

using OnAccept = std::function<std::shared_ptr<RSocketRequestHandler>(
using OnAccept = std::function<std::shared_ptr<RSocketResponder>(
std::shared_ptr<ConnectionSetupRequest>)>;
/**
* API for starting an RSocket server. Returned from RSocket::createServer.
Expand Down