void RoutingConnection::CalcCompletion(RoutingOp *theOp)
{
	OpCompletionBasePtr aCompletion = theOp->GetCompletion();
	if(aCompletion.get()==NULL)
		aCompletion = mCompletions[theOp->GetType()];

	if(aCompletion.get()==NULL)
		aCompletion = mDefaultCompletion;

	theOp->SetCompletion(aCompletion);
}
Exemplo n.º 2
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();
}
Exemplo n.º 3
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);
}