From 6393b2b06e32b2f8d3fcfce71714001114bc3875 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 15 Dec 2008 21:42:50 +0000 Subject: [PATCH] slight re-org of unknown client handling git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1529 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libopensrf/osrf_stack.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libopensrf/osrf_stack.c b/src/libopensrf/osrf_stack.c index 6f2fe09..8cc257b 100644 --- a/src/libopensrf/osrf_stack.c +++ b/src/libopensrf/osrf_stack.c @@ -66,24 +66,24 @@ osrfAppSession* osrf_stack_transport_handler( transport_message* msg, osrfAppSession* session = osrf_app_session_find_session( msg->thread ); - if(my_service) { - - if(session) { - if(strcmp(msg->sender, session->remote_id) != 0) { - /* unexpected client connection. See if we are running in "migratable" mode */ - char* mable = osrf_settings_host_value("/apps/%s/migratable", my_service); - if(!mable) { - osrfLogError("Connection to service %s from unknown client %s", my_service, msg->sender); - return NULL; - } - free(mable); - } - + if( session && + session->type == OSRF_SESSION_SERVER && + (strcmp(msg->sender, session->remote_id) != 0) ) { + + /* unexpected client connection. See if we are running in "migratable" mode */ + char* mable = osrf_settings_host_value("/apps/%s/migratable", session->remote_service); + if(mable) { + // free to migrate + free(mable); } else { - session = osrf_app_server_session_init(msg->thread, my_service, msg->sender); + osrfLogError("Connection to service %s from unknown client %s", session->remote_service, msg->sender); + return NULL; } } + if( !session && my_service ) + session = osrf_app_server_session_init( msg->thread, my_service, msg->sender); + if( !session ) { message_free( msg ); return NULL; -- 2.11.0