From: Miloš Mulač Date: Tue, 11 Sep 2007 15:30:14 +0000 (+0000) Subject: on proxy - do not store events which will arrive thru server too X-Git-Tag: glite-yaim-myproxy_R_4_0_1_1~22 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=5370b272edef918f20be4ec9b4a33d6643afde91;p=jra1mw.git on proxy - do not store events which will arrive thru server too --- diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index 2074fb6..d141bb2 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -390,6 +390,10 @@ int main(int argc, char *argv[]) name = strrchr(argv[0],'/'); if (name) name++; else name = argv[0]; + memset(host, 0, sizeof host); + edg_wll_gss_gethostname(host,sizeof host); + host[sizeof host - 1] = 0; + asprintf(&port, "%d", GLITE_JOBID_DEFAULT_PORT); #ifdef GLITE_LB_SERVER_WITH_WS asprintf(&ws_port, "%d", GLITE_JOBID_DEFAULT_PORT+3); @@ -553,13 +557,8 @@ int main(int argc, char *argv[]) } else fake_port = atoi(port); } - else - { - char buf[300]; - - edg_wll_gss_gethostname(buf,sizeof buf); - buf[sizeof buf - 1] = 0; - fake_host = strdup(buf); + else { + fake_host = strdup(host); fake_port = atoi(port); } @@ -1201,8 +1200,15 @@ int bk_handle_connection_proxy(int conn, struct timeval *timeout, void *data) ctx->semset = semset; ctx->semaphores = semaphores; - ctx->srvName = strdup(host); - ctx->srvPort = atoi(port); + if (fake_host) + { + ctx->srvName = strdup(fake_host); + ctx->srvPort = fake_port; + } + else { + ctx->srvName = strdup(host); + ctx->srvPort = atoi(port); + } ctx->connProxy = (edg_wll_ConnProxy *) calloc(1, sizeof(edg_wll_ConnProxy)); if ( !ctx->connProxy ) { diff --git a/org.glite.lb.server/src/db_store.c b/org.glite.lb.server/src/db_store.c index 4c7349b..23b1a8d 100644 --- a/org.glite.lb.server/src/db_store.c +++ b/org.glite.lb.server/src/db_store.c @@ -56,6 +56,21 @@ db_store(edg_wll_Context ctx,char *ucs, char *event) } #endif + /* events logged to proxy and server (DIRECT flag) may be ignored on proxy + * if jobid prefix hostname matches server hostname -> they will + * sooner or later arrive to server too and are stored in common DB + */ + if (ctx->isProxy && ctx->serverRunning && (ev->any.priority & EDG_WLL_LOGFLAG_DIRECT) ) { + char *srvName; + unsigned int srvPort; + + + edg_wlc_JobIdGetServerParts(ev->any.jobId, &srvName, &srvPort); + if (!strcmp(ctx->srvName, srvName)) { + return 0; + } + + } /* XXX: if event type is user tag, convert the tag name to lowercase! * (not sure whether to convert a value too is reasonable diff --git a/org.glite.lb.server/src/store.c.T b/org.glite.lb.server/src/store.c.T index 45e55ae..12241a7 100644 --- a/org.glite.lb.server/src/store.c.T +++ b/org.glite.lb.server/src/store.c.T @@ -292,7 +292,7 @@ static int store_job(edg_wll_Context ctx,const edg_wlc_JobId job,const char *use server = 1; } - trio_asprintf(&stmt,"insert into jobs(jobid,dg_jobid,userid,proxy,bkserver) " + trio_asprintf(&stmt,"insert into jobs(jobid,dg_jobid,userid,proxy,server) " "values ('%|Ss','%|Ss','%|Ss', '%|Sd', '%|Sd')",jobid,jobstr,userid,proxy,server); if (edg_wll_ExecStmt(ctx,stmt,NULL) < 0) {