#define PLUGIN_ID "GLITE_GSOAP_PLUGIN"
struct _glite_gsplugin_ctx {
- struct timeval timeout; /**< timeout for all netcalls
- * if tv_sec ==0 and tv_usec == 0 then
- * no timeout is used - every call will
- * be considered as a nonblocking */
+ struct timeval _timeout, *timeout;
char *error_msg;
extern void *glite_gsplugin_get_udata(struct soap *);
extern void glite_gsplugin_set_udata(struct soap *, void *);
+extern void glite_gsplugin_set_timeout(glite_gsplugin_Context, struct timeval const *);
+
extern int glite_gsplugin(struct soap *, struct soap_plugin *, void *);
extern char *glite_gsplugin_errdesc(struct soap *);
out->cred = GSS_C_NO_CREDENTIAL;
/* XXX: some troubles with glite_gss and blocking calls!
- */
out->timeout.tv_sec = 10000;
+ */
+
+ out->timeout = NULL;
*ctx = out;
return 0;
pdata->ctx->user_data = d;
}
+void glite_gsplugin_set_timeout(glite_gsplugin_Context ctx, struct timeval const *to)
+{
+ if (to) {
+ ctx->_timeout = *to;
+ ctx->timeout = &ctx->_timeout;
+ }
+ else ctx->timeout = NULL;
+}
+
+
int
glite_gsplugin(struct soap *soap, struct soap_plugin *p, void *arg)
{
if ( !(ctx->connection = malloc(sizeof(*ctx->connection))) ) return errno;
ret = edg_wll_gss_connect(ctx->cred,
host, port,
- (ctx->timeout.tv_usec || ctx->timeout.tv_sec)? &ctx->timeout: NULL,
+ ctx->timeout,
ctx->connection, &gss_stat);
if ( ret ) {
edg_wll_gss_get_error(&gss_stat, "edg_wll_gss_connect()", &ctx->error_msg);
if ( ctx->connection ) {
if ( ctx->connection->context != GSS_C_NO_CONTEXT) {
pdprintf(("GSLITE_GSPLUGIN: closing gss connection\n"));
- ret = edg_wll_gss_close(ctx->connection,
- (ctx->timeout.tv_usec || ctx->timeout.tv_sec)? &ctx->timeout: NULL);
+ ret = edg_wll_gss_close(ctx->connection, ctx->timeout);
}
ctx->connection->context = GSS_C_NO_CONTEXT;
}
if ( (conn = accept(s, (struct sockaddr *)&a, n)) < 0 ) return conn;
if ( !ctx->connection
&& !(ctx->connection = malloc(sizeof(*ctx->connection))) ) return -1;
- if ( edg_wll_gss_accept(ctx->cred, conn, &ctx->timeout, ctx->connection, &gss_code)) {
+ if ( edg_wll_gss_accept(ctx->cred, conn, ctx->timeout, ctx->connection, &gss_code)) {
pdprintf(("GSLITE_GSPLUGIN: Client authentication failed, closing.\n"));
edg_wll_gss_get_error(&gss_code, "Client authentication failed", &ctx->error_msg);
return -1;
}
len = edg_wll_gss_read(ctx->connection, buf, bufsz,
- (ctx->timeout.tv_usec || ctx->timeout.tv_sec)? &ctx->timeout: NULL,
+ ctx->timeout,
&gss_code);
switch ( len ) {
sigaction(SIGPIPE, &sa, &osa);
ret = edg_wll_gss_write_full(ctx->connection,
- (void*)buf, bufsz, &ctx->timeout, &total, &gss_code);
+ (void*)buf, bufsz, ctx->timeout, &total, &gss_code);
sigaction(SIGPIPE, &osa, NULL);
return SOAP_OK;
}
+