Example #1
0
void ServerConnection::ConnectCallback(PeerAuthOp *theOp)
{
	AutoCrit aCrit(mDataCrit);
	if(theOp!=mPeerAuthOp.get())
		return;

	OpCompletionBasePtr aConnectCompletion = mConnectCompletion;
	mPeerAuthOp = NULL;

	aCrit.Leave();

	if(aConnectCompletion.get()!=NULL)
		aConnectCompletion->Complete(theOp);

	if(theOp->Succeeded())
	{
		SetRepeatCompletion(new OpRefCompletion(StaticMsgCallback,this));
		SetRepeatOp(new RecvMsgOp);
	}

	StartKeepAlive();
}
Example #2
0
void AsyncOp::Complete()
{
	// Check if already completed
	AutoCrit aCrit(mStatusCrit);
	if(!AwaitingCompletion())
		return;

	mAwaitingCompletion = false;

	if(mTimerMap!=NULL)
	{
		aCrit.Leave();
		WONAPICore::RemoveFromTimerThread(this);
	}
	
	aCrit.Leave();

	CleanupHook();	

	OpCompletionBasePtr aCompletion = mCompletion;
	if(aCompletion.get()!=NULL)
		aCompletion->Complete(this);
}