Commit 17f65c38 authored by 's avatar

Reconnect of client after connection to mapid or mapicommd breaks (configure...

Reconnect of client after connection to mapid or mapicommd breaks (configure with the flag --enable-reconnect) - bug #444

git-svn-id: file:///home/svn/mapi/trunk@1138 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent b9f2d641
......@@ -228,6 +228,23 @@ else
AC_MSG_RESULT(no)
fi
# Reconnection
AC_MSG_CHECKING([if reconnection of client is enabled])
AC_ARG_ENABLE(reconnect,
AS_HELP_STRING([--enable-reconnect], [Enable support for reconnection of client after connection to mapicommd or mapid breaks down]),
[case "${enableval}" in
yes) reconnect=true ;;
no) reconnect=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-reconnect) ;;
esac], [reconnect=false])
AM_CONDITIONAL(BINARY_RECONNECT, test x$reconnect = xtrue)
if test x$reconnect = xtrue; then
AC_DEFINE(RECONNECT, 1, [Support for reconnect of client after connection to mapicommd or mapid breaks down])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# SSL sockets (only for DiMAPI)
if test x$dimapi = xtrue; then
AC_MSG_CHECKING([if SSL for DiMAPI is enabled])
......@@ -784,4 +801,6 @@ fi
if test x$authentication = xtrue; then
echo "option: authentication on"
fi
if test x$reconnect = xtrue; then
echo "option: RECONNECTION"
fi
This diff is collapsed.
......@@ -102,6 +102,10 @@ struct mapiipcbuf {
long mtype;
mapiipcMsg cmd;
int fd;
#ifdef RECONNECT
int user_fd;
int user_fid;
#endif
char function[FUNCT_NAME_LENGTH];
int fid;
int size;
......@@ -145,10 +149,13 @@ struct host {
#ifdef DIMAPISSL
SSL *con;
#endif
int num_flows; //to know when to close the socket
int num_flows; // to know when to close the socket
flist_t *flows;
flist_t* functions;
pthread_t* comm_thread; //communication thread
pthread_t* comm_thread; // communication thread
#ifdef RECONNECT
sem_t connection; // use it in mapiipc.c source code file
#endif
};
//Buffer that is sent to/from mapi and agent
......@@ -182,18 +189,18 @@ typedef struct remote_flowdescr {
flist_t* pkt_list; //FIFO list for get_next_pkt
sem_t fd_sem;
sem_t pkt_sem;
//unsigned int pending_msgs;
//pthread_mutex_t mutex;
//struct mapipkt* pkt; DELETE
flist_t* function_res;
unsigned char is_connected; // This should be 1 if the flow is connected 0 otherwise
/* int error;
char errstr[MAPI_ERRORSTR_LENGTH];
*/
#ifdef WITH_AUTHENTICATION
unsigned char is_authenticated;
char *username;
char *vo;
#ifdef RECONNECT
char *password;
#endif
#endif
#ifdef RECONNECT
int to_buffer_fid; // fid returned to user, in response to to_buffer() function apply
#endif
} remote_flowdescr_t;
......@@ -225,4 +232,3 @@ extern char * getargstr(mapiFunctArg **pos);
extern unsigned long long getargulonglong(mapiFunctArg **pos);
#endif//_MAPIIPC_H
This diff is collapsed.
......@@ -1578,6 +1578,19 @@ cmd_read_results (int fd, int fid, int pid, int sock)
int err;
char *p = (char *)buf.data;
#ifdef RECONNECT
if(fd == -1 && fid == -1){ // dummy message from MAPI stub
buf.mtype = -1;
buf.cmd = READ_RESULT_ACK;
buf.fd = fd;
buf.size = 0;
mapiipc_daemon_write(&buf, sock); // send a dummy message
return;
}
#endif
if (drv == NULL)
{
/* driver not found(should be handled in create_flow), or invalid flow id */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment