Do not disconnect backend if we received some data from it during ping timer period

This commit is contained in:
HanzZ 2012-12-03 11:49:18 +01:00
parent 8618b87051
commit 3e515d9f15
2 changed files with 11 additions and 3 deletions

View file

@ -48,7 +48,7 @@ void MyIrcSession::on_connected() {
// }
}
sendCommand(IrcCommand::createCapability("REQ", QStringList("away-notify")));
// sendCommand(IrcCommand::createCapability("REQ", QStringList("away-notify")));
for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
sendCommand(IrcCommand::createJoin(FROM_UTF8(it->second->getChannel()), FROM_UTF8(it->second->getPassword())));
@ -211,9 +211,9 @@ void MyIrcSession::on_numericMessageReceived(IrcMessage *message) {
np->handleSubject(user, TO_UTF8(m->parameters().value(1)) + suffix, m_topicData, nick);
break;
case 352:
channel = m->parameters().value(1);
nick = TO_UTF8(m->parameters().value(5));
if (m->parameters().value(6).toUpper().startsWith("G")) {
channel = m->parameters().value(1);
nick = TO_UTF8(m->parameters().value(5));
np->handleParticipantChanged(user, nick, TO_UTF8(channel) + suffix, m_modes[TO_UTF8(channel) + nick], pbnetwork::STATUS_AWAY);
}
break;

View file

@ -941,6 +941,14 @@ void NetworkPluginServer::handleDataRead(Backend *c, boost::shared_ptr<Swift::Sa
}
c->data.erase(c->data.begin(), c->data.begin() + 4 + expected_size);
// If backend is slow and it is sending us lot of message, there is possibility
// that we don't receive PONG response before timeout. However, if we received
// at least some data, it means backend is not dead and we can treat it as
// PONG received event.
if (c->pongReceived == false) {
c->pongReceived = true;
}
// Handle payload in wrapper message
switch(wrapper.type()) {
case pbnetwork::WrapperMessage_Type_TYPE_CONNECTED: