[update] Updated verbose plane handler (SGCA)
This commit is contained in:
parent
685d18df8f
commit
6fbd41542b
|
@ -75,13 +75,13 @@ void* managePlane(void* THREADABLE_ARGS){
|
|||
|
||||
/* 2.1. Si erreur reception (-1:erreur, 0:fermeture client propre) */
|
||||
if( read <= 0 ){
|
||||
if( DEBUGMOD&BUF ) printf("{tcp_com}(%d) read: %d -> must exit thread\n", index, read);
|
||||
if( DEBUGMOD&BUF ) printf("{tcp_com}(%d) Error receiving (%d), must exit thread\n", index, read);
|
||||
break;
|
||||
}
|
||||
|
||||
/* 2.2. Si message trop court */
|
||||
if( read != PLANE_LEN+1 ){
|
||||
if( DEBUGMOD&BUF ) printf("{tcp_com}(%d) read: %d (expected: %d)\n", index, read, (int) (PLANE_LEN+1) );
|
||||
if( DEBUGMOD&BUF ) printf("{tcp_com}(%d) Error receiving (%d bytes, but %d expected)\n", index, read, (int) (PLANE_LEN+1) );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -138,10 +138,11 @@ void* managePlane(void* THREADABLE_ARGS){
|
|||
|
||||
/* 4. On copie/met à jour les valeurs */
|
||||
if( tmpFlags != 0x10 ){ // gestion réponse ctrlTerm
|
||||
arg->sgca->unit[pindex].flags = tmpFlags; // on met à jour les flags
|
||||
while( arg->sgca->unit[pindex].thrId == 0xf0 ); // on attend le numéro de thread
|
||||
pthread_kill(arg->UDPManagers[arg->sgca->unit[pindex].thrId], SIGCONT); // on réveille le thread
|
||||
arg->sgca->unit[pindex].thrId = 0xf0; // on laisse la place pour qqn d'autre
|
||||
arg->sgca->unit[pindex].flags = tmpFlags; // on met à jour les flags
|
||||
while( arg->sgca->unit[pindex].thrId == 0xf0 ); // on attend le numéro de thread
|
||||
printf("{tcp_com}(%d) Waking up UDP threaad@%d for ctrlTerm response\n", index, arg->sgca->unit[pindex].thrId);
|
||||
pthread_kill(arg->UDPManagers[(int)arg->sgca->unit[pindex].thrId], SIGCONT); // on réveille le thread
|
||||
arg->sgca->unit[pindex].thrId = 0xf0; // on laisse la place pour qqn d'autre
|
||||
}
|
||||
memcpy(&arg->sgca->unit[pindex].data, &data, sizeof(struct plane));
|
||||
|
||||
|
@ -157,21 +158,16 @@ void* managePlane(void* THREADABLE_ARGS){
|
|||
arg->sgca->unit[pindex].socket = -1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [6] On libère la mémoire
|
||||
=========================================================*/
|
||||
|
||||
|
||||
|
||||
/* [7] Fermeture de la connection (SOCKET)
|
||||
=========================================================*/
|
||||
printf("{tcp_com}(%d) Closing communication socket\n", index);
|
||||
close(SOCKET);
|
||||
|
||||
|
||||
|
||||
/* [n] Arrêt du THREAD
|
||||
============================================================================*/
|
||||
/* 1. On met à jour "activeManagers" */
|
||||
|
|
Loading…
Reference in New Issue