--- rpl/src/instructions_r4.c 2011/04/17 14:01:23 1.28.2.3 +++ rpl/src/instructions_r4.c 2011/04/11 12:10:10 1.29 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.0.23 + RPL/2 (R) version 4.1.0.prerelease.0 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -903,6 +903,9 @@ instruction_read(struct_processus *s_eta (*s_etat_processus).erreur_execution = d_ex; + attente.tv_sec = 0; + attente.tv_nsec = GRANULARITE_us * 1000; + if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n READ "); @@ -2034,11 +2037,9 @@ instruction_read(struct_processus *s_eta } } -printf("<1>\n"); if ((*((struct_socket *) (*s_objet_argument_1).objet)).binaire == 'N') { // Socket formatée longueur_questure = 256; -printf("<2>\n"); do { @@ -2064,9 +2065,6 @@ printf("<2>\n"); } # endif - attente.tv_sec = 0; - attente.tv_nsec = GRANULARITE_us * 1000; - for(;;) { if ((*((struct_socket *) (*s_objet_argument_1).objet)) @@ -2138,15 +2136,14 @@ printf("<2>\n"); return; } - if (longueur_effective <= 0) + if (longueur_effective < 0) { nanosleep(&attente, NULL); - INCR_GRANULARITE(attente.tv_nsec); scrutation_injection(s_etat_processus); } if (((*s_etat_processus).var_volatile_requete_arret == -1) - || (longueur_effective > 0)) + || (longueur_effective >= 0)) { break; } @@ -2356,9 +2353,8 @@ printf("<2>\n"); longueur_adresse = 0; recvfrom((*((struct_socket *) (*s_objet_argument_1).objet)).socket, tampon_lecture, - longueur_effective, MSG_DONTWAIT, + position_finale, MSG_DONTWAIT, NULL, &longueur_adresse); -printf("<%s>\n", tampon_lecture); (*s_objet_adresse).objet = NULL; } @@ -2368,7 +2364,7 @@ printf("<%s>\n", tampon_lecture); longueur_adresse = sizeof(adresse_ipv4); recvfrom((*((struct_socket *) (*s_objet_argument_1).objet)).socket, tampon_lecture, - longueur_effective, MSG_DONTWAIT, + position_finale, MSG_DONTWAIT, (struct sockaddr *) &adresse_ipv4, &longueur_adresse); if (((*s_objet_adresse).objet = @@ -2448,7 +2444,7 @@ printf("<%s>\n", tampon_lecture); longueur_adresse = sizeof(adresse_ipv6); recvfrom((*((struct_socket *) (*s_objet_argument_1).objet)).socket, tampon_lecture, - longueur_effective, MSG_DONTWAIT, + position_finale, MSG_DONTWAIT, (struct sockaddr *) &adresse_ipv6, &longueur_adresse); if (((*s_objet_adresse).objet = @@ -2573,9 +2569,6 @@ printf("<%s>\n", tampon_lecture); } # endif - attente.tv_sec = 0; - attente.tv_nsec = GRANULARITE_us * 1000; - for(;;) { if ((*((struct_socket *) (*s_objet_argument_1).objet)) @@ -2650,7 +2643,6 @@ printf("<%s>\n", tampon_lecture); if (longueur_effective < 0) { nanosleep(&attente, NULL); - INCR_GRANULARITE(attente.tv_nsec); scrutation_injection(s_etat_processus); } @@ -2798,8 +2790,7 @@ printf("<%s>\n", tampon_lecture); /* * Les informations concernant la cible sont valides si - * la socket est non connectée et que les domaines sont - * INET ou INET6. + * la socket est non connectée et des domaines INET ou INET6. * Dans tous les autres cas, on renvoie une liste vide. */ @@ -2809,8 +2800,6 @@ printf("<%s>\n", tampon_lecture); (strcmp((*((struct_socket *) (*s_objet_argument_1).objet)) .type, "SEQUENTIAL DATAGRAM") == 0)) { - // POSITION_FINALE peut être utilisée sans être initialisée ! - // virer position_finale pour longueur_effective longueur_adresse = 0; recvfrom((*((struct_socket *) (*s_objet_argument_1).objet)).socket, tampon_lecture,