}
osrf_app_session* ptr = app_session_cache;
- debug_handler( "Pushing [%s] onto global session cache", session->session_id );
+ debug_handler( "Pushing [%s] [%s] onto global session cache",
+ session->remote_service, session->session_id );
while( ptr != NULL ) {
if( !strcmp(ptr->session_id, session->session_id) )
return;
session->request_queue = NULL;
session->remote_id = strdup(target_buf);
session->orig_remote_id = strdup(session->remote_id);
+ session->remote_service = strdup(remote_service);
/* build a chunky, random session id */
char id[256];
sprintf(id, "%lf.%d%d", get_timestamp_millis(), (int)time(NULL), getpid());
session->session_id = strdup(id);
- debug_handler( "Building a new client session with id [%s]", session->session_id );
+ debug_handler( "Building a new client session with id [%s] [%s]",
+ session->remote_service, session->session_id );
session->thread_trace = 0;
session->state = OSRF_SESSION_DISCONNECTED;
if(session)
return session;
- debug_handler( "Building a new server session with id [%s]", session_id );
session = safe_malloc(sizeof(osrf_app_session));
session->remote_id = strdup(remote_id);
session->orig_remote_id = strdup(remote_id);
session->session_id = strdup(session_id);
+ session->remote_service = strdup(remote_service);
+
+ debug_handler( "Building a new server session [%s] with id [%s]",
+ session->remote_service, session_id );
session->thread_trace = 0;
session->state = OSRF_SESSION_DISCONNECTED;
free(session->remote_id);
free(session->orig_remote_id);
free(session->session_id);
+ free(session->remote_service);
free(session);
}
if(session == NULL || req == NULL)
return;
- debug_handler( "Pushing [%d] onto requeust queue for session [%s]",
- req->request_id, session->session_id );
+ debug_handler( "Pushing [%d] onto requeust queue for session [%s] [%s]",
+ req->request_id, session->remote_service, session->session_id );
if(session->request_queue == NULL)
session->request_queue = req;
if(session->request_queue == NULL)
return;
- debug_handler("Removing request [%d] from session [%s]",
- req->request_id, session->session_id );
+ debug_handler("Removing request [%d] from session [%s] [%s]",
+ req->request_id, session->remote_service, session->session_id );
osrf_app_request* first = session->request_queue;
if(first->request_id == req->request_id) {
if(first->next == NULL) { /* only one in the list */
return;
free(session->remote_id);
- debug_handler( "App Session [%s] resetting remote id to %s",
- session->session_id, session->orig_remote_id );
+ debug_handler( "App Session [%s] [%s] resetting remote id to %s",
+ session->remote_service, session->session_id, session->orig_remote_id );
session->remote_id = strdup(session->orig_remote_id);
}
while( session->state != OSRF_SESSION_CONNECTED && remaining >= 0 ) {
osrf_app_session_queue_wait( session, remaining );
- debug_handler("In connect while with state: %x, %d [%s]", session, session->state, session->session_id );
remaining -= (int) (time(NULL) - start);
}
char* xml = osrf_message_to_xml(msg);
+ debug_handler("[%s] [%s] Remote Id: %s",
+ session->remote_service, session->session_id, session->remote_id );
+
transport_message* t_msg = message_init(
xml, "", session->session_id, session->remote_id, NULL );
- debug_handler("Sending XML:\n%s", xml );
+ debug_handler("Session [%s] [%s] sending to %s \nXML:\n%s",
+ session->remote_service, session->session_id, t_msg->recipient, xml );
ret_val = client_send_message( session->transport_handle, t_msg );
free(xml);
message_free( t_msg );
void osrf_app_session_destroy ( osrf_app_session* session ){
if(session == NULL) return;
- debug_handler( "AppSession [%s] destroying self and deleting requests", session->session_id );
+ debug_handler( "AppSession [%s] [%s] destroying self and deleting requests",
+ session->remote_service, session->session_id );
if(session->type == OSRF_SESSION_CLIENT
&& session->state != OSRF_SESSION_DISCONNECTED ) { /* disconnect if we're a client */
osrf_message* dis_msg = osrf_message_init( DISCONNECT, session->thread_trace, 1 );
}
//session->state = OSRF_SESSION_DISCONNECTED;
_osrf_app_session_remove_session(session->session_id);
- debug_handler("AppSession [%s] removed from cache", session->session_id );
+ debug_handler("AppSession [%s] [%s] removed from cache",
+ session->remote_service, session->session_id );
osrf_app_request* req;
while( session->request_queue != NULL ) {