double starttime = get_timestamp_millis();
int req_id = osrf_app_session_make_req( session, NULL, method, api_level, mparams );
+
+
+ if( req_id == -1 ) {
+ osrfLogError(OSRF_LOG_MARK, "I am unable to communcate with opensrf..going away...");
+ /* we don't want to spawn an intense re-forking storm
+ * if there is no jabber server.. so give it some time before we die */
+ sleep(1);
+ exit(1);
+ }
+
osrf_message* omsg = NULL;
int statuscode = 200;
session->remote_service, session->session_id, t_msg->recipient, string );
retval = client_send_message( session->transport_handle, t_msg );
+
+ if( retval ) osrfLogError(OSRF_LOG_MARK, "client_send_message failed");
free(string);
message_free( t_msg );
timeout = 0;
}
+ if( client->error ) {
+ osrfLogWarning(OSRF_LOG_MARK, "transport_client had trouble reading from the socket..");
+ return -1;
+ }
+
if( ! client_connected( client ) ) return -1;
return 0;
client->session = init_transport( server, port, unix_path, client, component );
client->session->message_callback = client_message_handler;
+ client->error = 0;
return client;
}
int client_send_message( transport_client* client, transport_message* msg ) {
if(client == NULL) return 0;
+ if( client->error ) return -1;
return session_send_msg( client->session, msg );
}
int x;
if( (x = session_wait( client->session, -1 )) ) {
osrfLogWarning(OSRF_LOG_MARK, "session_wait returned failure code %d\n", x);
+ client->error = 1;
return NULL;
}
}
int wait_ret;
while( client->m_list->next == NULL && remaining >= 0 ) {
- if( (wait_ret= session_wait( client->session, remaining)) )
+ if( (wait_ret= session_wait( client->session, remaining)) ) {
+ client->error = 1;
+ osrfLogWarning(OSRF_LOG_MARK, "session_wait returned failure code %d: setting error=1\n", wait_ret);
return NULL;
+ }
++counter;
struct transport_client_struct {
transport_message_list* m_list;
transport_session* session;
+ int error;
};
typedef struct transport_client_struct transport_client;
int ret = socket_wait( session->sock_mgr, timeout, session->sock_id );
if( ret ) {
+ osrfLogError(OSRF_LOG_MARK, "socket_wait returned error code %d", ret);
session->state_machine->connected = 0;
}
return ret;
if(read_bytes == 0) { /* socket closed by client */
if(mgr->on_socket_closed) {
mgr->on_socket_closed(mgr->blob, sock_fd);
- return -1;
}
+ return -1;
}
return 0;