Commit b0c8ee5d authored by 's avatar

fix in DiMAPI re-connection mechanism


git-svn-id: file:///home/svn/mapi/trunk@1375 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 5e136ae6
......@@ -3912,6 +3912,7 @@ int mapi_is_sensor_down(int fd){
if(rflow != NULL && rflow->daemons_down == 1)
return 1;
else if (rflow!=NULL) return 0;
#else
return 0; // without reconnect always up ??
#endif
......@@ -3920,15 +3921,16 @@ int mapi_is_sensor_down(int fd){
flowdescr_t *flow = flist_get(flowlist, fd);
int check_mapid;
if (flow==NULL) return 0;
check_mapid = check_network_mapid();
if(check_mapid == 1 && flow != NULL)
if(check_mapid == 1) { //up
flow->mapid_down = 0;
if(flow != NULL && flow->mapid_down == 1)
return 1;
else
return 0;
}
else
return 1;
#else
return 0; // without reconnect always up ??
#endif
......
......@@ -485,6 +485,16 @@ void *handle_request(void *arg) {
}
break;
case READ_RESULT:
#ifdef RECONNECT
if (mapi_is_sensor_down(dbuf->fd)==1) {
printf("SENSOR DOWN\n");
int local_err=MAPI_READ_RESULT_RECONNECTION;
dbuf->cmd = ERROR_ACK;
memcpy(dbuf->data, &local_err, sizeof(int));
dbuf->length = BASIC_SIZE + sizeof(int);
break;
}
#endif
result = mapi_read_results(dbuf->fd,dbuf->fid);
if(result!=NULL && result->size < DIMAPI_DATA_SIZE){
dbuf->cmd = READ_RESULT_ACK;
......
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