From: Aleš Křenek Date: Mon, 10 Dec 2007 10:12:28 +0000 (+0000) Subject: propagate notif expiration to IL X-Git-Tag: glite-lb-client_R_3_1_2_1~7 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=5de7c09e5833e0d0bf8b029f62d40b3c3c8021d6;p=jra1mw.git propagate notif expiration to IL --- diff --git a/org.glite.lb.server/src/il_notification.c b/org.glite.lb.server/src/il_notification.c index 72be506..3a20e7f 100644 --- a/org.glite.lb.server/src/il_notification.c +++ b/org.glite.lb.server/src/il_notification.c @@ -43,6 +43,7 @@ notif_create_ulm( const char *host, const uint16_t port, const char *owner, + int expires, const char *notif_data, char **ulm_data, char **reg_id_s) @@ -66,6 +67,8 @@ notif_create_ulm( event->notification.dest_port = port; if (notif_data) event->notification.jobstat = strdup(notif_data); + event->notification.expires = expires; + if ((*ulm_data = edg_wll_UnparseNotifEvent(context,event)) == NULL) { edg_wll_SetError(context, ret = ENOMEM, "edg_wll_UnparseNotifEvent()"); goto out; @@ -94,6 +97,7 @@ edg_wll_NotifSend(edg_wll_Context context, const char *host, int port, const char *owner, + int expires, const char *notif_data) { struct timeval timeout = {NOTIF_TIMEOUT, 0}; @@ -108,6 +112,7 @@ edg_wll_NotifSend(edg_wll_Context context, host, port, owner, + expires, notif_data, &ulm_data, ®_id_s))) { @@ -148,6 +153,7 @@ edg_wll_NotifJobStatus(edg_wll_Context context, const char *host, int port, const char *owner, + int expires, const edg_wll_JobStat notif_job_stat) { int ret=0; @@ -161,7 +167,7 @@ edg_wll_NotifJobStatus(edg_wll_Context context, goto out; } - if (ret=edg_wll_NotifSend(context, reg_id, host, port, owner, xml_esc_data)) { + if ((ret=edg_wll_NotifSend(context, reg_id, host, port, owner, expires, xml_esc_data))) { char *ed = NULL, *et = NULL; if(ret) edg_wll_UpdateError(context, ret, "edg_wll_NotifJobStatus()"); @@ -181,12 +187,13 @@ out: int -edg_wll_NotifChangeDestination(edg_wll_Context context, +edg_wll_NotifChangeIL(edg_wll_Context context, edg_wll_NotifId reg_id, const char *host, - int port) + int port, + int expires) { - return(edg_wll_NotifSend(context, reg_id, host, port, "", "")); + return(edg_wll_NotifSend(context, reg_id, host, port, "", expires, "")); } @@ -194,6 +201,6 @@ int edg_wll_NotifCancelRegId(edg_wll_Context context, edg_wll_NotifId reg_id) { - return(edg_wll_NotifSend(context, reg_id, NULL, 0, "", "")); + return(edg_wll_NotifSend(context, reg_id, NULL, 0, "", 0, "")); } diff --git a/org.glite.lb.server/src/il_notification.h b/org.glite.lb.server/src/il_notification.h index 52487c4..187c226 100644 --- a/org.glite.lb.server/src/il_notification.h +++ b/org.glite.lb.server/src/il_notification.h @@ -43,6 +43,7 @@ edg_wll_NotifSend(edg_wll_Context context, const char *host, int port, const char *owner, + int expires, const char *notif_data); @@ -63,6 +64,7 @@ edg_wll_NotifJobStatus(edg_wll_Context context, const char *host, int port, const char *owner, + int expires, const edg_wll_JobStat notif_job_stat); @@ -74,10 +76,11 @@ edg_wll_NotifJobStatus(edg_wll_Context context, * \see edg_wll_NotifSend() */ int -edg_wll_NotifChangeDestination(edg_wll_Context context, +edg_wll_NotifChangeIL(edg_wll_Context context, edg_wll_NotifId reg_id, const char *host, - int port); + int port, + int expires); /** Cancel registration. * Creates ULM string and uses edg_wll_NotifSend() to pass it to diff --git a/org.glite.lb.server/src/notif_match.c b/org.glite.lb.server/src/notif_match.c index e48014e..cde8fbf 100644 --- a/org.glite.lb.server/src/notif_match.c +++ b/org.glite.lb.server/src/notif_match.c @@ -27,7 +27,7 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *stat) edg_wll_NotifId nid = NULL; char *jobq,*ju = NULL,*jobc[5]; edg_wll_Stmt jobs = NULL; - int ret,i; + int ret,i,expires; time_t now = time(NULL); edg_wll_ResetError(ctx); @@ -49,7 +49,7 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *stat) if (edg_wll_ExecStmt(ctx,jobq,&jobs) < 0) goto err; while ((ret = edg_wll_FetchRow(jobs,jobc)) > 0) { - if (now > edg_wll_DBToTime(jobc[2])) + if (now > (expires = edg_wll_DBToTime(jobc[2]))) edg_wll_NotifExpired(ctx,jobc[0]); else if (notif_match_conditions(ctx,stat,jobc[4]) && notif_check_acl(ctx,stat,jobc[3])) @@ -81,7 +81,7 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *stat) /* XXX: only temporary hack!!! */ ctx->p_instance = strdup(""); - if ( edg_wll_NotifJobStatus(ctx, nid, dest, port, jobc[3], *stat) ) + if ( edg_wll_NotifJobStatus(ctx, nid, dest, port, jobc[3], expires, *stat) ) { free(dest); for (i=0; i