added some debugging when hunting memory error
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 25 Apr 2005 21:38:31 +0000 (21:38 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 25 Apr 2005 21:38:31 +0000 (21:38 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@291 9efc2488-bf62-4759-914b-345cdb29e865

src/gateway/mod_ils_gateway.c
src/libstack/osrf_app_session.c
src/libstack/osrf_stack.c
src/libtransport/transport_session.c

index 02e96f0..f74ef34 100644 (file)
@@ -210,14 +210,18 @@ static int mod_ils_gateway_method_handler (request_rec *r) {
                        buffer_add(tmp_buf,arg);
                        buffer_add(tmp_buf,buffer->buf);
                        arg = (char*) apr_pstrdup(p, tmp_buf->buf);
+       //              arg = buffer_data(tmp_buf);;
                        buffer_free(tmp_buf);
                } else {
                        arg = (char*) apr_pstrdup(p, buffer->buf);
+       //              arg = buffer_data(buffer);
                }
                buffer_free(buffer);
 
        } 
 
+       debug_handler("params args are %s", arg);
+
 
        if( ! arg || !arg[0] ) { /* we received no request */
                warning_handler("No Args");
@@ -230,9 +234,11 @@ static int mod_ils_gateway_method_handler (request_rec *r) {
        
        char* argcopy = (char*) apr_pstrdup(p, arg);
 
-       while( argcopy && (val = ap_getword(p, &argcopy, '&'))) {
+       while( argcopy && (val = ap_getword(p, (const char**) &argcopy, '&'))) {
+
+               //const char* val2 = val;
 
-               key = ap_getword(r->pool,&val, '=');
+               key = ap_getword(r->pool, (const char**) &val, '=');
                if(!key || !key[0])
                        break;
 
@@ -355,6 +361,7 @@ static int mod_ils_gateway_method_handler (request_rec *r) {
        } 
 
        osrf_app_session_request_finish( session, req_id );
+       debug_handler("gateway process message successfully");
 
        return OK;
 
index d3bdb63..f4c7b6d 100644 (file)
@@ -35,6 +35,7 @@ void _osrf_app_request_free( osrf_app_request * req ){
        if( req->payload ) {
                osrf_message_free( req->payload );
        }
+
        /*
        osrf_message* cur_msg = req->result;
        while( cur_msg != NULL ) {
@@ -46,6 +47,7 @@ void _osrf_app_request_free( osrf_app_request * req ){
        */
 
        free( req );
+       debug_handler("after request free");
 }
 
 /** Pushes the given message onto the list of 'responses' to this request */
@@ -364,22 +366,26 @@ void _osrf_app_session_remove_request( osrf_app_session* session, osrf_app_reque
 
        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 */
+               session->request_queue = first->next;
+               return;
+               /*
+               if(first->next == NULL) { 
                        session->request_queue = NULL;
                } else {
                        osrf_app_request* tmp = first->next;
                        session->request_queue = tmp;
                }
+               */
        }
 
        osrf_app_request* lead = first->next;
 
        while( lead != NULL ) {
                if(lead->request_id == req->request_id) {
-                       osrf_app_request* tmp = lead->next;
-                       first->next = tmp;
+                       first->next = lead->next;
                        return;
                }
                first = lead;
index b2cda4a..87e2118 100644 (file)
@@ -4,7 +4,9 @@ osrf_message* _do_client( osrf_app_session*, osrf_message* );
 osrf_message* _do_server( osrf_app_session*, osrf_message* );
 
 int osrf_stack_process( transport_client* client, int timeout ) {
+       debug_handler("osrf_stack_process going into client_recv");
        transport_message* msg = client_recv( client, timeout );
+       debug_handler("osrf_stack_process after client_recv");
        if(msg == NULL) return 0;
        debug_handler( "Received message from transport code from %s", msg->sender );
        int status = osrf_stack_transport_handler( msg );
index 607821b..ba79806 100644 (file)
@@ -318,7 +318,9 @@ int session_connect( transport_session* session,
 void grab_incoming( void * session, char* data ) {
        transport_session* ses = (transport_session*) session;
        if( ! ses ) { return; }
+       debug_handler("Parsing incoming XML chunk");
        xmlParseChunk(ses->parser_ctxt, data, strlen(data), 0);
+       debug_handler("Completed parsing incoming XML chunk");
 }
 
 
@@ -328,6 +330,8 @@ void startElementHandler(
        transport_session* ses = (transport_session*) session;
        if( ! ses ) { return; }
 
+       debug_handler("transport_session: startElementHandler");
+
        
        if( strcmp( name, "message" ) == 0 ) {
                ses->state_machine->in_message = 1;
@@ -445,6 +449,8 @@ void endElementHandler( void *session, const xmlChar *name) {
        transport_session* ses = (transport_session*) session;
        if( ! ses ) { return; }
 
+       debug_handler("transport_session: endElementHandler");
+
        if( strcmp( name, "message" ) == 0 ) {
 
                /* pass off the message info the callback */
@@ -560,6 +566,8 @@ void characterHandler(
        strncpy( data, (char*) ch, len );
        data[len] = 0;
 
+       debug_handler("transport_session: characterElementHandler");
+
        //printf( "Handling characters: %s\n", data );
        transport_session* ses = (transport_session*) session;
        if( ! ses ) { return; }