diff --git a/maestro/pool_client.c b/maestro/pool_client.c index 2958786bf01be3191942aa06fd0d321fb0057a11..04d634bf19d5afe54df0ed061d7476822286ba17 100644 --- a/maestro/pool_client.c +++ b/maestro/pool_client.c @@ -855,19 +855,17 @@ mstro_pc__app_befriend(mstro_pool_operation op) struct mstro_pm_app_registry_entry *e; mstro_app_id appid = op->pc_transport.target_appid; status = mstro_pm_app_lookup(appid, &e); - if(e) { /**found an entry ... good */ - if(e->pending) { + if(status == MSTRO_WOULDBLOCK) { DEBUG("app entry is already being read ... wait until it completes\n"); status = MSTRO_WOULDBLOCK; /* we need to wait until the read is complete */ return status; - } else - { + } else if ((e!=NULL)&& (status == MSTRO_OK)) + { DEBUG("Found app %zu in local registry, good\n", appid); op->step++; /**jump app reg step to go directly to writing and sending the ticket */ return MSTRO_OK; /**we can continue execution */ - } - } + } else { /**Did not find an entry, will submit read*/ DEBUG("Unknown app %zu, let's make friends\n", appid); diff --git a/maestro/pool_manager_registry.c b/maestro/pool_manager_registry.c index 6c53fc31c9e48831d7ecf023c5c33a2a2fe4ed37..f4c811b86b4c87a7847404f7aa6b001281eca35d 100644 --- a/maestro/pool_manager_registry.c +++ b/maestro/pool_manager_registry.c @@ -185,7 +185,7 @@ mstro_pm_app_register(const struct mstro_endpoint *ep, goto BAILOUT; } - e->ep = ep; + e->ep = (struct mstro_endpoint *) ep; e->addr = addr; e->serialized_desc = serialized_desc; e->transport_methods = (Mstro__Pool__TransportMethods *)transport_methods; @@ -292,7 +292,7 @@ mstro_pc_app_register(struct mstro_endpoint *ep, e->serialized_desc = serialized_desc; e->pending = false; - e->transport_methods=transport_methods; + e->transport_methods= (Mstro__Pool__TransportMethods *) transport_methods; /* FIXME: we should check that there is no previous entry and * document whether that's an error or a legal way of overriding @@ -372,9 +372,16 @@ mstro_pm_app_lookup(mstro_app_id appid, WITH_LOCKED_APP_REGISTRY({ struct mstro_pm_app_registry_entry *e=NULL; HASH_FIND(hh, g_mstro_pm_app_registry, &appid, sizeof(mstro_app_id), e); - if(e!=NULL) { - *app_entry_p = e; - } else { + if((e!=NULL) && (e->pending)) { + status = MSTRO_WOULDBLOCK; + *app_entry_p = NULL; + } + else if( (e!=NULL) &&(!e->pending)) + { + status = MSTRO_OK; + *app_entry_p = e; + } + else { *app_entry_p = NULL; status=MSTRO_FAIL; }