mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Added some notes.
This commit is contained in:
parent
059cae3625
commit
4f39060341
@ -36,6 +36,10 @@
|
||||
#include "event_loop.h"
|
||||
#include <functional>
|
||||
|
||||
// Inherit from socket?
|
||||
// Could be called ServerSocket
|
||||
// New connection callback -> make it a virtual func?
|
||||
|
||||
using NewConnectionCallback = std::function<void(int fd, const InetAddress &)>;
|
||||
class Acceptor {
|
||||
protected:
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
|
||||
class EventLoop;
|
||||
/**
|
||||
* @brief This class is used to implement reactor pattern. A Channel object
|
||||
|
@ -35,6 +35,10 @@
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
// inherit from socket?
|
||||
// Could be called ClientSocket
|
||||
// New connection callback -> make it a virtual func?
|
||||
|
||||
class Connector : public std::enable_shared_from_this<Connector> {
|
||||
protected:
|
||||
Connector(const Connector &) = delete;
|
||||
|
@ -99,8 +99,7 @@ TcpClient::~TcpClient() {
|
||||
loop_->runInLoop([conn, loop]() {
|
||||
conn->setCloseCallback([loop](const TcpConnectionPtr &connPtr) {
|
||||
loop->queueInLoop([connPtr]() {
|
||||
static_cast<TcpConnectionImpl *>(connPtr.get())
|
||||
->connectDestroyed();
|
||||
static_cast<TcpConnectionImpl *>(connPtr.get())->connectDestroyed();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -43,6 +43,16 @@ class Connector;
|
||||
using ConnectorPtr = std::shared_ptr<Connector>;
|
||||
class SSLContext;
|
||||
|
||||
//maybe:
|
||||
//Reference -> Socket -> ConnectionListener (Channel?) -> Connector (ClientSocket) -> TcpClient
|
||||
// -> Acceptor (ServerSocket) -> TcpServer
|
||||
//Reference -> TcpConnection (with a connectionlistener member) -> TcpConnectionDefault
|
||||
//Also todo move around the core net classes a bit more
|
||||
|
||||
|
||||
//should be ConnectionListener derived
|
||||
//Inherit from Connector (which Could be called ClientSocket)?
|
||||
|
||||
class TcpClient {
|
||||
protected:
|
||||
TcpClient(const TcpClient &) = delete;
|
||||
|
@ -38,6 +38,10 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// add new class TcpConnectionListener or ConnectionListener
|
||||
//set_listener(ConnectionListener)
|
||||
// instead of callbacks
|
||||
|
||||
class SSLContext;
|
||||
std::shared_ptr<SSLContext> newSSLServerContext(const std::string &certPath, const std::string &keyPath, bool useOldTLS = false, const std::vector<std::pair<std::string, std::string> > &sslConfCmds = {});
|
||||
|
||||
|
@ -44,6 +44,8 @@
|
||||
class Acceptor;
|
||||
class SSLContext;
|
||||
|
||||
//Inherit from Acceptor (-> Could be called ServerSocket)?
|
||||
|
||||
class TcpServer {
|
||||
protected:
|
||||
TcpServer(const TcpServer &) = delete;
|
||||
@ -125,7 +127,9 @@ public:
|
||||
private:
|
||||
EventLoop *loop_;
|
||||
std::unique_ptr<Acceptor> acceptorPtr_;
|
||||
|
||||
void newConnection(int fd, const InetAddress &peer);
|
||||
|
||||
std::string serverName_;
|
||||
std::set<TcpConnectionPtr> connSet_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user