
Originally Posted by
wizard_hu_
Starting again from scratch may behave better, so after RConnection::Close you may try if issuing RSocketServ::Close improves stability, or anything.
Yeah, it does, provided that you can actually close the connection, which is not taken for granted.
For example / zum Beispiel / például / například:
Implementation like this:
Code:
class CPrepare_AO : public CActive
{
public:
IMPORT_C CPrepare_AO();
IMPORT_C void StartConnection(RConnection& aConnection, TCommDbConnPref& aPref);
virtual void RunL();
virtual void DoCancel();
};
EXPORT_C CPrepare_AO::CPrepare_AO() : CActive(EPriorityStandard) { CActiveScheduler::Add(this); }
EXPORT_C void CPrepare_AO::StartConnection(RConnection& aConnection, TCommDbConnPref& aPref)
{
aConnection.Start(aPref, iStatus);
SetActive();
}
void CPrepare_AO::RunL()
{
// Some code for success, irrelevant here.
}
void CPrepare_AO::DoCancel()
{
// Do nothing!! There is no specific code for canceling the connection
}
has the following sweet property: if your attempt to Start() does not succeed fast (and it does not, if you attempt to connect over GPRS on a bad signal), then simply invoking Cancel() on the above mentioned active object hangs the entire thread, even though DoCancel() implementation is empty.
It seems that RConnection gone wrong is a very dangerous object to touch.