parse = 1;
}
else {
- switch (purge_one(ctx,job,dumpfile,request->flags&EDG_WLL_PURGE_REALLY_PURGE,0)) {
+ switch (purge_one(ctx,job,dumpfile,request->flags&EDG_WLL_PURGE_REALLY_PURGE,ctx->isProxy)) {
case 0: if (request->flags & EDG_WLL_PURGE_LIST_JOBS) {
result->jobs = realloc(result->jobs,(naffected_jobs+2) * sizeof(*(result->jobs)));
result->jobs[naffected_jobs] = strdup(request->jobs[i]);
for (i=0; i<EDG_WLL_NUMBER_OF_STATCODES; i++)
timeout[i] = request->timeout[i] < 0 ? ctx->purge_timeout[i] : request->timeout[i];
- if (edg_wll_ExecSQL(ctx,"select dg_jobid from jobs where server='1'",&s) < 0) goto abort;
+ if (edg_wll_ExecSQL(ctx, (ctx->isProxy) ? "select dg_jobid from jobs where proxy='1'" :
+ "select dg_jobid from jobs where server='1'", &s) < 0) goto abort;
+
while ((res = edg_wll_FetchRow(ctx,s,1,NULL,&job_s)) > 0) {
if (edg_wlc_JobIdParse(job_s,&job)) {
fprintf(stderr,"%s: parse error (internal inconsistency !)\n",job_s);
if (now-stat.lastUpdateTime.tv_sec > timeout[i] && !check_strict_jobid(ctx,job))
{
- if (purge_one(ctx,job,dumpfile,request->flags&EDG_WLL_PURGE_REALLY_PURGE,0)) {
+ if (purge_one(ctx,job,dumpfile,request->flags&EDG_WLL_PURGE_REALLY_PURGE,ctx->isProxy)) {
edg_wll_FreeStatus(&stat);
if (edg_wll_Error(ctx, NULL, NULL) == ENOENT) {
/* job purged meanwhile, ignore */
#include "glite/lb/mini_http.h"
#include "glite/lb/query_rec.h"
#include "glite/lb/consumer.h"
+#include "glite/lb/connection.h"
#define dprintf(x) { if (debug) printf x; }
{ "version", no_argument, NULL, 'v' },
{ "debug", no_argument, NULL, 'd' },
{ "server", required_argument, NULL, 'm' },
+ { "proxy", no_argument, NULL, 'x' },
+ { "sock", required_argument, NULL, 'X' },
{ NULL, no_argument, NULL, 0 }
};
" -h, --help display this help\n"
" -v, --version display version\n"
" -d, --debug diagnostic output\n"
- " -m, --server L&B server machine name\n",
+ " -m, --server L&B server machine name\n"
+ " -x, --proxy purge L&B proxy\n"
+ " -X, --sock <path> purge L&B proxy using default socket path\n",
me);
}
me = strrchr(argv[0],'/');
if (me) me++; else me=argv[0];
+ /* initialize context */
+ edg_wll_InitContext(&ctx);
+
/* get arguments */
- while ((opt = getopt_long(argc,argv,"a:c:n:o:j:m:rlsidhv",opts,NULL)) != EOF) {
+ while ((opt = getopt_long(argc,argv,"a:c:n:o:j:m:rlsidhvxX:",opts,NULL)) != EOF) {
timeout=-1;
switch (opt) {
case 'i': request->flags |= EDG_WLL_PURGE_CLIENT_DUMP; break;
case 'd': debug = 1; break;
case 'v': fprintf(stdout,"%s:\t%s\n",me,rcsid); exit(0);
+ case 'x': ctx->isProxy = 1; break;
+ case 'X':
+ ctx->isProxy = 1;
+ edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_SERVE_SOCK, optarg);
+ break;
case 'h':
case '?': usage(me); return 1;
}
}
- /* initialize context */
- edg_wll_InitContext(&ctx);
-
/* read the jobIds from file, if wanted */
if (file) {
char **jobs=NULL;
ctx->p_tmp_timeout = ctx->p_query_timeout;
if (ctx->p_tmp_timeout.tv_sec < 600) ctx->p_tmp_timeout.tv_sec = 600;
- if (set_server_name_and_port(ctx, NULL))
- goto edg_wll_purge_end;
-
- if (edg_wll_http_send_recv(ctx,
- "POST /purgeRequest HTTP/1.1", request_headers, send_mess,
- &response, NULL, &recv_mess))
- goto edg_wll_purge_end;
+
+ if (ctx->isProxy){
+ ctx->isProxy = 0;
+ if (edg_wll_http_send_recv_proxy(ctx, "POST /purgeRequest HTTP/1.1",
+ request_headers,send_mess,&response,NULL,&recv_mess))
+ goto edg_wll_purge_end;
+ }
+ else {
+ if (set_server_name_and_port(ctx, NULL))
+ goto edg_wll_purge_end;
+
+ if (edg_wll_http_send_recv(ctx,
+ "POST /purgeRequest HTTP/1.1", request_headers, send_mess,
+ &response, NULL, &recv_mess))
+ goto edg_wll_purge_end;
+ }
- if (http_check_status(ctx, response, &recv_mess))
+ if (http_check_status(ctx, response))
goto edg_wll_purge_end;
if (edg_wll_ParsePurgeResult(ctx, recv_mess, result))