#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
+#include <time.h>
#include "glite/jp/types.h"
#include "glite/jp/context.h"
#define USER_QUERY_SLAVES_NUM 2 // # of slaves reserved for user queries if
// # PS to conntact is << MAX_SLAVES_NUM
+#define RECONNECT_TIME 60*20 // when try reconnect to PS in case of error (in sec)
+
+
extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
extern SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
// namespaces[] not used here, but need to prevent linker to complain...
free(PS_URL);
glite_jpis_free_context(private->ctx);
return -1;
+ case ENOTCONN:
+ // error when connecting to PS
+ glite_jpis_tryReconnectFeed(private->ctx, uniqueid,
+ time(NULL) + RECONNECT_TIME);
+ break;
default:
// contact PS server, ask for data, save feedId and expiration
// to DB and unlock feed
MyFeedIndex(private->ctx, conf, uniqueid, PS_URL);
free(PS_URL);
PS_URL = NULL;
-// FIXME: infinite retrying on fail ==> fast increasing of used resources
- sleep(2);
break;
}
} while (1);
}
+/* Saves TTL (when to reconnect if error occured) for given feed */
+
+void glite_jpis_tryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time) {
+
+}
+
+
int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av) {
char *sql, *table, *value, *full_value;
int glite_jpis_lockUninitializedFeed(glite_jpis_context_t ctx, long int *uinqueid, char **PS_URL);
int glite_jpis_initFeed(glite_jpis_context_t ctx, long int uniqueid, char *feedId, time_t feedExpires);
int glite_jpis_unlockFeed(glite_jpis_context_t ctx, long int uniqueid);
+void glite_jpis_tryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time);
int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av);