The complete source code of IdealIRC http://www.idealirc.org/
 
 
 
 
idealirc/IRCClient/Private/keepaliveTimeout.cpp

21 lines
622 B

/*
* IdealIRC Core - Internet Relay Chat API
* Copyright (C) 2021 Tom-Andre Barstad.
* This software is licensed under the Software Attribution License.
* See LICENSE for more information.
*/
#include "../IRCBasePriv.h"
#include "../Commands.h"
#include <fmt/format.h>
void IRCBasePriv::keepaliveTimeout(const asio::error_code& ec)
{
using namespace Command::IRC;
if (ec != asio::error::operation_aborted && isOnline) {
auto ts = std::chrono::steady_clock::now().time_since_epoch().count();
write(Command::IRC::PING, fmt::format("KeepAlive {}", ts));
startKeepaliveTimer();
}
}