msg->thread_trace = thread_trace;
msg->protocol = protocol;
msg->next = NULL;
+ msg->is_exception = 0;
return msg;
}
if( msg == NULL )
fatal_handler( "Bad params to osrf_message_set_status_info()" );
- if( msg->m_type == STATUS )
- if( status_name != NULL )
- msg->status_name = strdup( status_name );
+ if( status_name != NULL )
+ msg->status_name = strdup( status_name );
if( status_text != NULL )
msg->status_text = strdup( status_text );
name = xmlGetProp( cur_node, BAD_CAST "name");
if(name) {
-
+
if( !strcmp(name,"oilsMethod") ) {
xmlNodePtr meth_node = cur_node->children;
}
if( !strcmp((char*)meth_node->name,"params" ) && meth_node->children->content )
- new_msg->params = json_object_new_string( meth_node->children->content );
- //new_msg->params = json_tokener_parse(ng(json_params));
+ //new_msg->params = json_object_new_string( meth_node->children->content );
+ new_msg->params = json_tokener_parse(meth_node->children->content);
meth_node = meth_node->next;
}
}
}
- if( new_msg->m_type == STATUS ) { new_msg->status_name = strdup(name); }
+ if( new_msg->m_type == STATUS )
+ new_msg->status_name = strdup(name);
+
xmlFree(name);
}
}
osrf_app_session* session = osrf_app_session_find_session( msg->thread );
- if( session == NULL ) /* we must be a server, build a new session */
- fatal_handler( "Server sessions not implemented yet ..." );
+ if( session == NULL ) { /* we must be a server, build a new session */
+ info_handler( "Server sessions not implemented yet ..." );
+ return 0;
+ }
osrf_app_session_set_remote( session, msg->sender );
osrf_message* arr[OSRF_MAX_MSGS_PER_PACKET];
if(session == NULL || msg == NULL)
return 0;
- osrf_message* ret_msg;
+ osrf_message* ret_msg = NULL;
if( session->type == OSRF_SESSION_CLIENT )
ret_msg = _do_client( session, msg );
else
ret_msg= _do_server( session, msg );
if(ret_msg)
- osrf_stack_application_handler( session, msg );
+ osrf_stack_application_handler( session, ret_msg );
return 1;
if(session == NULL || msg == NULL)
return NULL;
- //osrf_message* new_msg;
+ osrf_message* new_msg;
if( msg->m_type == STATUS ) {
default:
- warning_handler("We don't know what to do with the provided message code: %d", msg->status_code );
+ new_msg = osrf_message_init( RESULT, msg->thread_trace, msg->protocol );
+ osrf_message_set_status_info( new_msg,
+ msg->status_name, msg->status_text, msg->status_code );
+ warning_handler("The stack doesn't know what to do with "
+ "the provided message code: %d, name %s. Passing UP.",
+ msg->status_code, msg->status_name );
+ new_msg->is_exception = 1;
+ osrf_app_session_set_complete( session, msg->thread_trace );
+ osrf_message_free(msg);
+ return new_msg;
}
return NULL;
printf( "\nReceived Data: %s\n",content );
free(content);
}
- else
- printf( "\nReceived Message but no result data\n");
+ else {
+ printf( "\nReceived Exception:\nName: %s\nStatus: "
+ "%s\nStatusCode %d\n", omsg->status_name,
+ omsg->status_text, omsg->status_code );
+ }
osrf_message_free(omsg);
omsg = osrf_app_session_request_recv( session, req_id, 5 );