14.Controlling event or transmission operation (callback)

ProudNet supports a function that controls event or transmission operation (callback).

14.1Cutting callback in operation from client

When CNetClient.FrameMove is called, all accumulated events and reception RMIs get called at the same time(refer to 9. Understanding client main loop). ProudNet allows its user to abort the operation of accumulated events and reception RMIs being managed within one time called CNetClient.FrameMove and return in the middle.And the remaining events and reception RMIs can be managed by CNetClient.FrameMove call.

When you even wish to stop the operation of remaining events or reception RMIs, you can call either Proud.INetClientEvent.HolsterMoreCallbackUntilNextFrameMove or Proud.IRmiStub.HolsterMoreCallbackUntilNextFrameMove from the routine managing RMI reception or event reception.

DEFRMI_TestS2C_Foo(CMyClient)
{
    ...
    /* CNetClient.FrameMove ignores the remaining accumulated events and reception RMIs then returns immediately. */
    HolsterMoreCallbackUntilNextFrameMove();
}

void CMyClient::OnClientLeave(...)
{
    ...
        /* When you call this, CNetClient.FrameMove ignores the remaining accumulated events and reception RMIs then returns immediately */
        HolsterMoreCallbackUntilNextFrameMove();
}

14.2Postponing callback from client

When callbacks of every event and reception RMI are received through Proud.CNetClient.FrameMove, there is a function that can prompt callback of your choice again.This function is called Postponing callback.

When you postpone a callback, it lines up at the end of accumulated reception cues.Then the associated callback will be performed when CNetClient.FrameMove is called.

For instance, if you want to postpone Callback B, it get operated as shown in below.

FrameMove = > Callback A = > Callback B(Postpone!) = > Return

FrameMove = > Callback B(Play the postponed) = > ... = > Return

Using this callback function without thorough understanding can cause the infinite loop of callback or mess up the arrival order of reception RMIs or events.Please be cautious as using this function.

If you want to postpone a callback, all you need to do is to call either Proud.INetClientEvent.PostponeThisCallback or Proud.IRmiStub.PostponeThisCallback from the routine where RMI or event reception is being managed.

DEFRMI_TestS2C_Foo(CMyClient)
{
    ...
    /* When this is called, CNetClient.FrameMove ignores the remaining
        RMI and event reception and return immediately. */    PostponeThisCallback();
}

void CMyClient::OnClientLeave(...)
{
    ...
    /* When this is called, CNetClient.FrameMove ignores the remaining
        RMI and event reception and return immediately. */    PostponeThisCallback();
}