Summary: | Exceeded rate limit not dealt with correctly | ||
---|---|---|---|
Product: | [Applications] kopete | Reporter: | Till Gerken <till.gerken> |
Component: | ICQ and AIM Plugins | Assignee: | Matt Rogers <mattr> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Till Gerken
2003-07-30 12:27:48 UTC
There is another case where it correctly pops up a message saying that I most likely tried to reconnect to the server too fast and am now banned. In this case, the connecting animation does not stop and reconnecting is not possible until the next restart of Kopete. Not sure if these bugs are the same, but I will post the debug output here as well: kopete (oscar): [void OscarSocket::OnConnect()] Connected to login.icq.com, port 5190 kopete (oscar): [void OscarSocket::OnConnect()] address() is 192.168.2.131 mDirectIMMgr->address() is 192.168.2.131 kopete (oscar): [void OscarSocket::OnConnAckReceived()] Called. kopete (oscar): [void OscarSocket::OnConnAckReceived()] ICQ-LOGIN, sending ICQ login kopete (oscar): [void OscarSocket::sendLoginICQ()] Sending ICQ login info... (CLI_COOKIE) kopete (oscar): [QCString OscarSocket::encodePasswordXOR()] kopete (oscar): [virtual void OscarSocket::slotRead()] Got connection close request, length=38 kopete (oscar): contained TLVs: kopete (oscar): TLV(1) with length 6 kopete (oscar): TLV(8) with length 2 kopete (oscar): TLV(4) with length 18 kopete (oscar): found TLV(1) [UIN], uin=389743 kopete (oscar): [virtual void OscarSocket::slotRead()] found TLV(8) [ERROR] error= 24 kopete (oscar): [virtual void OscarSocket::slotRead()] rate exceeded (maybe reconnecting too fast), server-ban for at least 10 mins!!! kopete (oscar): [void OscarAccount::slotError(QString, int)] accountId()='389743' errmsg=Server has blocked ICQ account 389743 for sending messages too quickly. Wait ten minutes and try again. If you continue to try, you will need to wait even longer., errorCode=0. kopete (oscar): [virtual void OscarSocket::doLogoff()] QSocket state wasn't idle, closing down socket... kopete (oscar): found TLV(4) [DESCRIPTION] reason=http://www.aol.com The second comment is caused by the inital report, and occurs because the server actually sends us an error packet. I'm working on a horrible, terrible, hacky workaround for this (basically adding a sleep(1) when we're about 100 points below the disconnect limit). Should have it in by the weekend. I'll CCMAIL the bug report the commit and then you can try it out. replace that sleep by a bBlockSend variable and set that to false in a singleShot timer called after 100ms (or whatever time you prefer). Subject: kdenetwork/kopete/protocols/oscar/oscarsocket CVS commit by mattr: Fix for bug 61848 using a single shot timer that fires on current rate level divided by 2 milliseconds. CCMAIL: 61848-done@bugs.kde.org M +18 -1 oscarsocket.cpp 1.128 M +8 -0 oscarsocket.h 1.78 --- kdenetwork/kopete/protocols/oscar/oscarsocket/oscarsocket.cpp #1.127:1.128 @@ -57,4 +57,5 @@ OscarSocket::OscarSocket(const QString & mFileTransferMgr=0L; awaitingFirstPresenceBlock = OscarSocket::Waiting; + mBlockSend = false; socket()->enableWrite(false); // don't spam us with readyWrite() signals @@ -120,4 +121,12 @@ DWORD OscarSocket::setIPv4Address(const } +void OscarSocket::slotToggleSend() +{ + if (mBlockSend) + mBlockSend = false; + else + mBlockSend = true; +} + void OscarSocket::slotConnected() { @@ -566,5 +575,5 @@ void OscarSocket::sendBuf(Buffer &outbuf #endif - if(socket()->socketStatus() != KExtendedSocket::connected) + if(socket()->socketStatus() != KExtendedSocket::connected || mBlockSend) kdDebug(14150) << k_funcinfo << "Socket is NOT open, can't write to it right now" << endl; else @@ -2633,4 +2642,12 @@ void OscarSocket::parseRateChange(Buffer BYTE currentState = inbuf.getByte(); kdDebug(14150) << k_funcinfo << "currentState=" << currentState << endl; + + if (code == 0x0002) //we've been warned about exceeding the rate limit + { + slotToggleSend(); + kdDebug(14150) << "Warning about the rate limit received. Waiting " + << currentLevel / 2 << "milliseconds" << endl; + QTimer::singleShot( currentLevel / 2, this, SLOT(slotToggleSend())); + } /* --- kdenetwork/kopete/protocols/oscar/oscarsocket/oscarsocket.h #1.77:1.78 @@ -842,4 +842,10 @@ class OscarSocket : public OscarConnecti void slotKeepaliveTimer(); + /** + * Called by the singleshot timer that is set when we've reached + * the rate limit warning + */ + void slotToggleSend(); + signals: @@ -996,4 +1002,6 @@ class OscarSocket : public OscarConnecti // Tells if we are connected to the server and ready to operate bool isLoggedIn; + // Tells if we can send data to the server or not + bool mBlockSend; /* I tried exceeding the rate limit (go.icq.com is such a beautiful tool for that) and Kopete did not pop up a warning or anything, it simply kept spinning the flower while from the console it could clearly be seen that the server terminated the connection (it detected the rate limit, too). no really? Who would have guessed that, a bug that isn't marked as FIXED is still happening :P Also note that the patch from Matt does not fix this bug anyway, exceeding the rate does not mean sending slower makes it any better. 1. The values of that rate-exceeded packet mean something but we don't know what they mean 2. There are several limits, one means "send slower", but there's also the "I want you to disconnect now" limit According to the console output, the plugin actually notices that the server wants it to disconnect - I think the socket is even being closed. However, the plugin keeps sending data happily ever after. hmm, the patch that I committed only did anything if we receieved a warning packet, so that's strike one. It also gobbled packets in the sending function beacuse instead of waiting for mBlockSend to be false, it just left the function, so that's strike two. No strike three yet, but i'm sure it'll be there when i put a better fix in later tonight or tomorrow. Subject: kdenetwork/kopete/protocols/oscar/oscarsocket CVS commit by mattr: Fix bug 61848 by disconnecting when we've hit (or gone over) the disconnect limit. Also make the rate level detection slightly more intelligent and make better use of it when determining how long we need to delay to keep from going over the disconnect limit in the first place. CCMAIL: 61848-done@bugs.kde.org (what a long message for such small changes) M +18 -6 oscarsocket.cpp 1.141 --- kdenetwork/kopete/protocols/oscar/oscarsocket/oscarsocket.cpp #1.140:1.141 @@ -2812,10 +2812,22 @@ void OscarSocket::parseRateChange(Buffer kdDebug(14150) << "New Level is: " << newLevel << endl; - if (code == 0x0002) //we've been warned about exceeding the rate limit + if (currentLevel >= disconnectLevel) + { + emit protocolError(i18n("The account %1 will be disconnected for exceeding the rate limit." \ + "Please wait approximately 10 minutes before reconnecting.") + .arg(mAccount->accountId()),0); + + //let the account properly clean itself up + mAccount->disconnect(); + } + else + { + if (code == 0x0002 || code == 0x0003) { slotToggleSend(); kdDebug(14150) << "Warning about the rate limit received. Waiting " - << currentLevel / 2 << "milliseconds" << endl; - QTimer::singleShot( currentLevel / 2, this, SLOT(slotToggleSend())); + << newLevel / 2 << "milliseconds" << endl; + QTimer::singleShot( newLevel / 2, this, SLOT(slotToggleSend())); + } } |