Chatsync
bbffde5c0c672a526bdc83637acf66dc20a80fbf
|
#include <ircchannel.hpp>
Public Member Functions | |
IrcChannel (Hub::Hub *hub, const std::string &config) | |
~IrcChannel () | |
std::string | type () const override |
![]() | |
Channel (Hub::Hub *const hub, const std::string &config) | |
virtual | ~Channel () |
virtual std::string const & | name () const |
ChannelDirection | direction () const |
virtual int | connect (const std::string &hostname, const uint32_t port) const |
virtual int | send (const uint32_t fd, const std::string &msg) const |
virtual int | send (const std::string &msg) const |
virtual int | disconnect (const uint32_t fd) const |
virtual int | disconnect () const |
Protected Member Functions | |
void | tick () override |
void | incoming (const messaging::message_ptr &&msg) override |
![]() | |
virtual void | pollThread () |
void | startPolling () |
void | stopPolling () |
Private Member Functions | |
void | registerConnection () |
void | ping () |
void | pong () const |
void | checkTimeout () |
std::future< void > | activate () override |
const messaging::message_ptr | parse (const char *line) const override |
const messaging::message_ptr | parseImpl (const std::string &toParse) const |
Private Attributes | |
const std::string | _server |
const uint32_t | _port |
const std::string | _channel |
std::chrono::time_point< std::chrono::high_resolution_clock > | _ping_time |
std::mutex | _pong_time_mutex |
std::chrono::time_point< std::chrono::high_resolution_clock > | _last_pong_time |
std::atomic_bool | _connection_issue |
Static Private Attributes | |
static const channeling::ChannelCreatorImpl< IrcChannel > | creator |
Additional Inherited Members | |
![]() | |
const uint16_t | _id |
![]() | |
std::atomic_bool | _active |
std::unique_ptr< std::thread > | _thread |
std::atomic_bool | _pipeRunning |
int | _fd |
const config::ConfigParser | _config |
const std::string | _name |
const ChannelDirection | _direction |
Hub::Hub *const | _hub |
IRC connection channel
Capable of connection an IRC server, joining one single channel and message transmission/receiving. Responds to PING with PONG to maintain connection.
|
explicit |
ircChannel::IrcChannel::~IrcChannel | ( | ) |
|
overrideprivatevirtual |
Prepare all prerequisites for polling thread or prepare the output and start working
Opening file descriptors, connecting to network must be done here. After future is valid channel is considered to be ready for work.
activate_error | in case of problems |
Implements channeling::Channel.
|
private |
|
overrideprotectedvirtual |
Parse line and send it to needed output place in case of Output direction
msg | Incoming message from hub. Passed by value to preserve ownership and ensure existence during processing in all output channels. |
Implements channeling::Channel.
|
overrideprivatevirtual |
Parse a text line and generate a corresponding Message
line | Text line from socket. |
nullptr | If message was technical for protocol. |
message_ptr | If useful payload found. |
Implements channeling::Channel.
|
private |
|
private |
Sends PING message to server
|
private |
Reacts to PONG message from server
|
private |
Sends PASS, NICK and USER commands to register irc connection
|
overrideprotectedvirtual |
If during max_timeout*5 we got no PONG we try to reconnect
Reimplemented from channeling::Channel.
|
inlineoverridevirtual |
Return channel "type" — unique string to identify channel in config file
std::string | Type line |
Implements channeling::Channel.
|
private |
Channel name (starting with #)
|
mutableprivate |
< The connection issue has been detected, check is ongoing
|
mutableprivate |
Last pong received from server
|
private |
Ping to server in microseconds
|
mutableprivate |
Lock for _last_pong_time
|
private |
Connection port
|
private |
Server address
|
staticprivate |