From 03b8a08db24649731c21a0923f1922537e14c1f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 12 Oct 2005 10:13:17 +0000 Subject: [PATCH] More elaborated connection error messages, localhost as default JP. --- org.glite.jp.index/src/bones_server.c | 6 ++++- org.glite.jp.index/src/conf.c | 3 ++- org.glite.jp.index/src/soap_ps_calls.c | 46 ++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/org.glite.jp.index/src/bones_server.c b/org.glite.jp.index/src/bones_server.c index 0803b12..6443da1 100644 --- a/org.glite.jp.index/src/bones_server.c +++ b/org.glite.jp.index/src/bones_server.c @@ -284,7 +284,11 @@ static int newconn(int conn,struct timeval *to,void *data) /* TODO: DNS paranoia etc. */ if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) { - printf("[%d] GSS connection accept failed, closing.\n", getpid()); + char *et; + + edg_wll_gss_get_error(&gss_code,"",&et); + + printf("[%d] GSS connection accept failed: %s\nClosing connection.\n", getpid(), et); ret = 1; goto cleanup; } diff --git a/org.glite.jp.index/src/conf.c b/org.glite.jp.index/src/conf.c index 4bab10e..1742f1a 100644 --- a/org.glite.jp.index/src/conf.c +++ b/org.glite.jp.index/src/conf.c @@ -42,7 +42,8 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf conf->feeds = calloc(2, sizeof(*(conf->feeds))); conf->feeds[0] = calloc(1, sizeof(**(conf->feeds))); - conf->feeds[0]->PS_URL = strdup("http://umbar-test.ics.muni.cz:8901"); +// conf->feeds[0]->PS_URL = strdup("http://umbar.ics.muni.cz:8901"); + conf->feeds[0]->PS_URL = strdup("http://localhost:8901"); // all job since Epoche conf->feeds[0]->query = calloc(2,sizeof(*conf->feeds[0]->query)); diff --git a/org.glite.jp.index/src/soap_ps_calls.c b/org.glite.jp.index/src/soap_ps_calls.c index 536d59f..920c2aa 100644 --- a/org.glite.jp.index/src/soap_ps_calls.c +++ b/org.glite.jp.index/src/soap_ps_calls.c @@ -1,5 +1,6 @@ #include #include +#include #include "glite/jp/types.h" #include "glite/jp/context.h" @@ -59,6 +60,48 @@ static void err2fault(const glite_jp_context_t ctx,struct soap *soap) } +static int check_fault(struct soap *soap,int err) { + struct SOAP_ENV__Detail *detail; + struct jptype__genericFault *f; + char *reason,indent[200] = " "; + + switch(err) { + case SOAP_OK: puts("OK"); + break; + case SOAP_FAULT: + case SOAP_SVR_FAULT: + if (soap->version == 2) { + detail = soap->fault->SOAP_ENV__Detail; + reason = soap->fault->SOAP_ENV__Reason; + } + else { + detail = soap->fault->detail; + reason = soap->fault->faultstring; + } + fputs(reason,stderr); + putc('\n',stderr); + assert(detail->__type == SOAP_TYPE__genericFault); +#if GSOAP_VERSION >=20700 + f = ((struct _genericFault *) detail->fault) +#else + f = ((struct _genericFault *) detail->value) +#endif + -> jpelem__genericFault; + + while (f) { + fprintf(stderr,"%s%s: %s (%s)\n",indent, + f->source,f->text,f->description); + f = f->reason; + strcat(indent," "); + } + return -1; + + default: soap_print_fault(soap,stderr); + return -1; + } + return 0; +} + /*----------------------*/ /* PS WSDL client calls */ @@ -120,8 +163,7 @@ printf("MyFeedIndex for %s called\n", dest); in.history = conf->feeds[dest_index]->history; in.continuous = conf->feeds[dest_index]->continuous; - //if (!check_fault(soap,soap_call_jpsrv___FeedIndex(soap,dest,"", - if (soap_call___jpsrv__FeedIndex(soap,dest,"", &in, &out)) { + if (check_fault(soap,soap_call___jpsrv__FeedIndex(soap,dest,"", &in, &out)) != 0) { printf("\n"); glite_jpis_unlockFeed(ctx, uniqueid); err.code = EIO; -- 1.8.2.3