Skip to content

silgy_app_continue

Jurek Muszyński edited this page May 18, 2019 · 7 revisions

void silgy_app_continue(int ci, const char *data)

Depreciated since v4.2.1. To enable backward compability, define ASYNC_USE_APP_CONTINUE. Otherwise the engine will just pass all the data received from silgy_svc to the client.

Description

Called after CALL_ASYNC() when response has been received from the silgy_svc process. data is the data returned from the async service. silgy_app_continue is the last stop before building HTTP response header and writing response back to user agent.

SVC macro can be used for dispatching.

ASYNC_ERR_CODE can be used to determine the error code set by the service.

Returns

None

Example

void silgy_app_continue(int ci, const char *data)
{
    if ( SVC("getCount") )
    {
        OUT("<p>getCount says %s</p>", data);
    }
    else if ( SVC("getCustomer") )
    {
        if ( ASYNC_ERR_CODE == ERR_ASYNC_TIMEOUT )
        {
            OUT("<p>getCustomer timeout</p>");
            RES_STATUS(500);
        }
        else if ( ASYNC_ERR_CODE == ERR_REMOTE_CALL )
        {
            OUT("<p>getCustomer call failed</p>");
            RES_STATUS(500);
        }
        else if ( ASYNC_ERR_CODE == ERR_REMOTE_CALL_STATUS )
            OUT("<p>Call response status wasn't successful</p>");
        else if ( ASYNC_ERR_CODE == OK )
            OUT("<p>%s</p>", data);
    }

    gen_footer(ci);
}

Notes

Requires ASYNC compilation switch.

Clone this wiki locally