fix: request more historical messages on wake (#5018)
This commit is contained in:
@@ -85,6 +85,9 @@ AbstractIrcServer::AbstractIrcServer()
|
||||
}
|
||||
this->readConnection_->smartReconnect();
|
||||
});
|
||||
this->connections_.managedConnect(this->readConnection_->heartbeat, [this] {
|
||||
this->markChannelsConnected();
|
||||
});
|
||||
}
|
||||
|
||||
void AbstractIrcServer::initializeIrc()
|
||||
@@ -358,11 +361,21 @@ void AbstractIrcServer::onDisconnected()
|
||||
|
||||
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||
{
|
||||
channel->markDisconnectedNow();
|
||||
channel->markDisconnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractIrcServer::markChannelsConnected()
|
||||
{
|
||||
this->forEachChannel([](const ChannelPtr &chan) {
|
||||
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||
{
|
||||
channel->markConnected();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel> AbstractIrcServer::getCustomChannel(
|
||||
const QString &channelName)
|
||||
{
|
||||
|
||||
@@ -73,6 +73,7 @@ protected:
|
||||
virtual void onReadConnected(IrcConnection *connection);
|
||||
virtual void onWriteConnected(IrcConnection *connection);
|
||||
virtual void onDisconnected();
|
||||
void markChannelsConnected();
|
||||
|
||||
virtual std::shared_ptr<Channel> getCustomChannel(
|
||||
const QString &channelName);
|
||||
|
||||
@@ -64,6 +64,7 @@ IrcConnection::IrcConnection(QObject *parent)
|
||||
// If we're still receiving messages, all is well
|
||||
this->recentlyReceivedMessage_ = false;
|
||||
this->waitingForPong_ = false;
|
||||
this->heartbeat.invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ public:
|
||||
// receiver to trigger a reconnect, if desired
|
||||
pajlada::Signals::Signal<bool> connectionLost;
|
||||
|
||||
// Signal to indicate the connection is still healthy
|
||||
pajlada::Signals::NoArgSignal heartbeat;
|
||||
|
||||
// Request a reconnect with a minimum interval between attempts.
|
||||
// This won't violate RECONNECT_MIN_INTERVAL
|
||||
void smartReconnect();
|
||||
|
||||
Reference in New Issue
Block a user