function startRouter {
- "$BINDIR/router" "$ETCDIR/opensrf_core.xml"
+ "$BINDIR/opensrf_router" "$ETCDIR/opensrf_core.xml"
}
function startOpenSRF {
sleep 1;
echo "Stopping The Router...";
- killall router;
+ killall opensrf_router;
sleep 1;
;;
"stop")
- PID=$(ps ax | grep "[0-9] System$" | awk '{print $1}');
+ PID=$(ps ax | grep -i "opensrf system" | grep -v grep | awk '{print $1}');
+
if [ -z "$PID" ]; then
echo "OpenSRF System is not running";
exit;
+
+ else
+ echo "Killing System...$PID";
+ kill -s INT $PID;
fi
- echo "Killing System...$PID";
- kill -s INT $PID;
+
echo "Done";
;;
"status")
- PID=$(ps ax | grep "[0-9] System$" | awk '{print $1}');
+ PID=$(ps ax | grep -i "opensrf system" | grep -v grep | awk '{print $1}');
if [ -z "$PID" ]; then
echo "OpenSRF System is not running";
exit 0;
signal(SIGINT, &sig_int_handler);
signal(SIGTERM, &sig_int_handler);
+ //init_proc_title( argc, argv );
+ //set_proc_title( "opensrf jabber" );
+
launch_server();
return 0;
}
char* context = strdup( argv[3] );
init_proc_title( argc, argv );
- set_proc_title( "opensrf system" );
+ set_proc_title( "OpenSRF System" );
osrfSystemBootstrap( host, config, context );
return NULL;
}
+ int stateless = 0;
+ char* statel = osrf_settings_host_value("/apps/%s/stateless", our_app );
+ if(statel) stateless = atoi(statel);
+ free(statel);
+
+
session->request_queue = NULL;
session->remote_id = strdup(remote_id);
session->orig_remote_id = strdup(remote_id);
session->session_id = strdup(session_id);
session->remote_service = strdup(our_app);
+ session->stateless = stateless;
#ifdef ASSUME_STATELESS
session->stateless = 1;
- #else
- session->stateless = 0;
#endif
session->thread_trace = 0;
if(!appname) fatal_handler("osrf_prefork_run requires an appname to run!");
- set_proc_title( "opensrf listener [%s]", appname );
+ set_proc_title( "OpenSRF Listener [%s]", appname );
int maxr = 1000;
int maxc = 10;
jsonObject* min_children = osrf_settings_host_value_object("/apps/%s/unix_config/min_children", appname);
jsonObject* max_children = osrf_settings_host_value_object("/apps/%s/unix_config/max_children", appname);
+
if(!max_req) warning_handler("Max requests not defined, assuming 1000");
else maxr = (int) jsonObjectGetNumber(max_req);
fatal_handler("Unable to bootstrap client for osrf_prefork_run()");
free(resc);
- set_proc_title( "opensrf drone [%s]", child->appname );
+ set_proc_title( "OpenSRF Drone [%s]", child->appname );
}
void prefork_child_process_request(prefork_child* child, char* data) {
osrfAppSession* session = osrf_stack_transport_handler(msg, child->appname);
- if( ! session->stateless ) { /* keepalive loop for stateful sessions */
+ if( session->stateless && session->state != OSRF_SESSION_CONNECTED ) return;
+
+ /* keepalive loop for stateful sessions */
debug_handler("Entering keepalive loop for session %s", session->session_id );
- }
}
# Start a process group and make me the captain
setpgrp( 0, 0 );
- $0 = "System";
+ $0 = "OpenSRF System";
# -----------------------------------------------
# Launch the settings sever if necessary...
LDLIBS += -lxml2 -lopensrf -lobjson
CFLAGS += -D_ROUTER
-all: router
+all: opensrf_router
install:
- cp router $(BINDIR)
+ cp opensrf_router $(BINDIR)
-router: router.o
+opensrf_router: router.o
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) router.o -o $@
router.o: router.c router.h
clean:
- /bin/rm -f *.o router
+ /bin/rm -f *.o opensrf_router
+
osrfConfig* cfg = osrfConfigInit( argv[1], "router" );
osrfConfigSetDefaultConfig(cfg);
+ init_proc_title( argc, argv );
+ set_proc_title( "OpenSRF Router" );
+
/* load the config options */
char* server = osrfConfigGetValue(NULL, "/transport/server");
char* port = osrfConfigGetValue(NULL, "/transport/port");
#define BUFFER_MAX_SIZE 10485760
-/* these are evil and should be condemned */
+/* these are evil and should be condemned
+ ! Only use these if you are done with argv[].
+ call init_proc_title() first, then call
+ set_proc_title.
+ the title is only allowed to be as big as the
+ initial process name of the process (full size of argv[]).
+ truncation may occurr.
+ */
int init_proc_title( int argc, char* argv[] );
int set_proc_title( char* format, ... );