1 #include <opensrf/osrf_app_session.h>
2 #include <opensrf/osrf_application.h>
3 #include <opensrf/osrf_json.h>
4 #include <opensrf/log.h>
6 #define MODULENAME "opensrf.cslow"
8 int osrfAppInitialize();
9 int osrfAppChildInit();
10 int osrfCSlowWait( osrfMethodContext* );
13 int osrfAppInitialize() {
15 osrfAppRegisterMethod(
19 "Wait specified number of seconds, then return that number", 1, 0 );
24 int osrfAppChildInit() {
28 int osrfCSlowWait( osrfMethodContext* ctx ) {
29 if( osrfMethodVerifyContext( ctx ) ) {
30 osrfLogError( OSRF_LOG_MARK, "Invalid method context" );
34 const jsonObject* x = jsonObjectGetIndex(ctx->params, 0);
38 char* a = jsonObjectToSimpleString(x);
42 unsigned int pause = atoi(a);
45 jsonObject* resp = jsonNewNumberObject(pause);
46 osrfAppRespondComplete( ctx, resp );