[update] Sending flag 0x10 when plane update request and offline/unreachable

This commit is contained in:
xdrm-brackets 2017-05-03 17:01:02 +02:00
parent c3fa24d747
commit 29393a0747
1 changed files with 5 additions and 2 deletions

View File

@ -382,7 +382,7 @@ void* manageCtrlTerm(void* THREADABLE_ARGS){
update = ( request.flags&TERMREQ_ALT || request.flags&TERMREQ_CAP || request.flags&TERMREQ_SPD ); update = ( request.flags&TERMREQ_ALT || request.flags&TERMREQ_CAP || request.flags&TERMREQ_SPD );
fbk = request.flags&TERMREQ_FBK; fbk = request.flags&TERMREQ_FBK;
if( !( update || fbk ) ){ if( !( update || fbk ) ){
send(arg->socket, "\0\0", sizeof(char)*2, 0); send(arg->socket, "\x00\0", sizeof(char)*2, 0);
printf("{udp_cterm}{com}(%d) Invalid flag, passing\n", index); printf("{udp_cterm}{com}(%d) Invalid flag, passing\n", index);
continue; continue;
} }
@ -398,7 +398,7 @@ void* manageCtrlTerm(void* THREADABLE_ARGS){
for( i = 0 ; i < arg->sgca->n ; i++ ){ for( i = 0 ; i < arg->sgca->n ; i++ ){
/* 2. Si l'avion existe et online -> on passe à la suite */ /* 2. Si l'avion existe et online -> on passe à la suite */
if( strcmp(arg->sgca->unit[i].data.code, request.update.code) == 0 && arg->sgca->unit[i].data.online ){ if( strcmp(arg->sgca->unit[i].data.code, request.update.code) == 0 && arg->sgca->unit[i].data.online == 1 ){
pindex = i; pindex = i;
break; break;
} }
@ -410,6 +410,7 @@ void* manageCtrlTerm(void* THREADABLE_ARGS){
/* 3. Si on a pas trouvé -> on quitte l'udpdate */ /* 3. Si on a pas trouvé -> on quitte l'udpdate */
if( pindex <= -1 || arg->sgca->unit[pindex].socket <= -1 ){ if( pindex <= -1 || arg->sgca->unit[pindex].socket <= -1 ){
printf("{udp_cterm}{com}(%d) Plane unknown or unreachable, passing\n", index); printf("{udp_cterm}{com}(%d) Plane unknown or unreachable, passing\n", index);
request.flags = 0x10;
break; break;
} }
@ -428,6 +429,7 @@ void* manageCtrlTerm(void* THREADABLE_ARGS){
/* 3. On envoie la requête à l'avion */ /* 3. On envoie la requête à l'avion */
if( send(arg->sgca->unit[pindex].socket, buffer, count/sizeof(char), 0) <= 0 ){ if( send(arg->sgca->unit[pindex].socket, buffer, count/sizeof(char), 0) <= 0 ){
printf("{udp_cterm}{com}(%d) Cannot send request to plane\n", index); printf("{udp_cterm}{com}(%d) Cannot send request to plane\n", index);
request.flags = 0x10;
break; break;
} }
@ -442,6 +444,7 @@ void* manageCtrlTerm(void* THREADABLE_ARGS){
if( flags == 0x10 ){ if( flags == 0x10 ){
printf("{udp_cterm}{com}(%d) Cannot get response from plane %d (%d)\n", index, count, (int) PLANE_LEN); printf("{udp_cterm}{com}(%d) Cannot get response from plane %d (%d)\n", index, count, (int) PLANE_LEN);
request.flags = 0x10;
break; break;
} }