SNode.C
|
#include <SocketConnection.h>
Public Member Functions | |
SocketConnectionT ()=delete | |
int | getFd () const final |
void | setTimeout (const utils::Timeval &timeout) final |
const SocketAddress & | getLocalAddress () const final |
const SocketAddress & | getRemoteAddress () const final |
std::size_t | readFromPeer (char *chunk, std::size_t chunkLen) final |
void | sendToPeer (const char *chunk, std::size_t chunkLen) final |
bool | streamToPeer (core::pipe::Source *source) final |
void | streamEof () final |
void | shutdownRead () final |
void | shutdownWrite (bool forceClose) final |
void | close () final |
Config & | getConfig () const |
std::size_t | getTotalSent () const override |
std::size_t | getTotalQueued () const override |
std::size_t | getTotalRead () const override |
std::size_t | getTotalProcessed () const override |
virtual void | sendToPeer (const char *chunk, std::size_t chunkLen)=0 |
void | sendToPeer (const std::string &data) |
![]() | |
SocketConnection (int fd, const net::config::ConfigInstance *config) | |
SocketConnection (const SocketConnection &)=delete | |
void | sendToPeer (const std::string &data) |
void | sentToPeer (const std::vector< uint8_t > &data) |
void | sentToPeer (const std::vector< char > &data) |
const std::string & | getInstanceName () const |
const std::string & | getConnectionName () const |
SocketContext * | getSocketContext () const |
std::string | getOnlineSince () const |
std::string | getOnlineDuration () const |
const net::config::ConfigInstance * | getConfig () const |
Protected Types | |
using | Super = core::socket::stream::SocketConnection |
using | Config = ConfigT |
using | PhysicalSocket = PhysicalSocketT |
using | SocketReader = SocketReaderT |
using | SocketWriter = SocketWriterT |
using | SocketAddress = typename PhysicalSocket::SocketAddress |
Protected Member Functions | |
SocketConnectionT (PhysicalSocket &&physicalSocket, const std::function< void()> &onDisconnectm, const std::shared_ptr< Config > &config) | |
~SocketConnectionT () override | |
void | doWriteShutdown (const std::function< void()> &onShutdown) override |
void | onWriteError (int errnum) |
void | onReadError (int errnum) |
![]() | |
virtual | ~SocketConnection () |
void | setSocketContext (SocketContext *socketContext) |
void | connectSocketContext (const std::shared_ptr< SocketContextFactory > &socketContextFactory) |
Private Member Functions | |
void | onReceivedFromPeer (std::size_t available) final |
bool | onSignal (int signum) final |
void | readTimeout () final |
void | writeTimeout () final |
void | unobservedEvent () final |
Private Attributes | |
PhysicalSocket | physicalSocket |
std::function< void()> | onDisconnect |
SocketAddress | localAddress {} |
SocketAddress | remoteAddress {} |
std::shared_ptr< Config > | config |
Additional Inherited Members | |
![]() | |
core::socket::stream::SocketContext * | socketContext = nullptr |
std::string | instanceName |
std::string | connectionName |
std::chrono::time_point< std::chrono::system_clock > | onlineSinceTimePoint |
Definition at line 154 of file SocketConnection.h.
|
protected |
Definition at line 161 of file SocketConnection.h.
|
protected |
Definition at line 162 of file SocketConnection.h.
|
protected |
Definition at line 165 of file SocketConnection.h.
|
protected |
Definition at line 163 of file SocketConnection.h.
|
protected |
Definition at line 164 of file SocketConnection.h.
|
protected |
Definition at line 159 of file SocketConnection.h.
|
delete |
|
protected |
Definition at line 107 of file SocketConnection.hpp.
References core::socket::stream::SocketConnection::connectionName, core::socket::stream::SocketConnection::instanceName, core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::onReadError(), and utils::PreserveErrno::PreserveErrno().
|
overrideprotected |
Definition at line 158 of file SocketConnection.hpp.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 234 of file SocketConnection.hpp.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::readTimeout(), core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::legacy::SocketReader, core::socket::stream::legacy::SocketWriter, ConfigT >::unobservedEvent(), and core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::writeTimeout().
|
overrideprotected |
Definition at line 269 of file SocketConnection.hpp.
References core::socket::stream::SocketConnection::connectionName, core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::physicalSocket, and core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::setTimeout().
Config & core::socket::stream::SocketConnectionT< PhysicalSocket, SocketReader, SocketWriter, Config >::getConfig | ( | ) | const |
Definition at line 244 of file SocketConnection.hpp.
References core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::config.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 168 of file SocketConnection.hpp.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 174 of file SocketConnection.hpp.
Referenced by tls::getClient(), legacy::getLegacyClient(), and main().
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 180 of file SocketConnection.hpp.
Referenced by tls::getClient(), legacy::getLegacyClient(), and main().
|
overridevirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 264 of file SocketConnection.hpp.
|
overridevirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 254 of file SocketConnection.hpp.
|
overridevirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 259 of file SocketConnection.hpp.
|
overridevirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 249 of file SocketConnection.hpp.
|
protected |
Definition at line 296 of file SocketConnection.hpp.
References core::socket::stream::SocketContext::onReadError(), and core::socket::stream::SocketConnection::socketContext.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::SocketConnectionT().
|
finalprivate |
Definition at line 286 of file SocketConnection.hpp.
References core::socket::stream::SocketContext::readFromPeer(), and core::socket::stream::SocketConnection::socketContext.
|
finalprivate |
Definition at line 301 of file SocketConnection.hpp.
References core::socket::stream::SocketConnection::connectionName, core::socket::SocketContext::onSignal(), utils::system::sigabbrev_np(), and core::socket::stream::SocketConnection::socketContext.
|
protected |
Definition at line 291 of file SocketConnection.hpp.
References core::socket::stream::SocketContext::onWriteError(), and core::socket::stream::SocketConnection::socketContext.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 185 of file SocketConnection.hpp.
|
finalprivate |
Definition at line 321 of file SocketConnection.hpp.
References core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::close(), and core::socket::stream::SocketConnection::connectionName.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 190 of file SocketConnection.hpp.
|
virtual |
Implements core::socket::stream::SocketConnection.
void core::socket::stream::SocketConnection::sendToPeer | ( | const std::string & | data | ) |
Definition at line 96 of file SocketConnection.cpp.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 162 of file SocketConnection.hpp.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::doWriteShutdown().
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 205 of file SocketConnection.hpp.
References core::socket::stream::SocketConnection::connectionName.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 218 of file SocketConnection.hpp.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 200 of file SocketConnection.hpp.
|
finalvirtual |
Implements core::socket::stream::SocketConnection.
Definition at line 195 of file SocketConnection.hpp.
|
finalprivate |
Definition at line 333 of file SocketConnection.hpp.
References core::socket::stream::SocketConnection::connectionName, core::socket::stream::SocketContext::detach(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::onDisconnect, and core::socket::stream::SocketConnection::socketContext.
|
finalprivate |
Definition at line 327 of file SocketConnection.hpp.
References core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::close(), and core::socket::stream::SocketConnection::connectionName.
|
private |
Definition at line 228 of file SocketConnection.h.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::getConfig().
|
private |
Definition at line 225 of file SocketConnection.h.
|
private |
Definition at line 223 of file SocketConnection.h.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::unobservedEvent().
|
private |
|
private |
Definition at line 226 of file SocketConnection.h.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT, ConfigT >::getRemoteAddress().