Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
project_TRTP
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Samuel de Meester de Ravestein
project_TRTP
Validations
25a92034
Valider
25a92034
rédigé
3 years ago
par
Samuel de Meester de Ravestein
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
fix NACK for sender
parent
844c53dd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/sender.c
+1
-1
1 ajout, 1 suppression
src/sender.c
src/sender_utils.c
+9
-6
9 ajouts, 6 suppressions
src/sender_utils.c
avec
10 ajouts
et
7 suppressions
src/sender.c
+
1
−
1
Voir le fichier @
25a92034
...
@@ -140,7 +140,7 @@ int main(int argc, char **argv) {
...
@@ -140,7 +140,7 @@ int main(int argc, char **argv) {
break
;
break
;
}
}
if
(
pfd
->
revents
&
POLLIN
)
if
(
(
pfd
->
revents
&
POLLIN
)
&&
(
pfd
->
revents
&
POLLOUT
))
{
{
DEBUG
(
"The sender is reading from the socket"
);
DEBUG
(
"The sender is reading from the socket"
);
rvalue
=
handle_returning_ack_nack
(
state
,
socket_fd
);
rvalue
=
handle_returning_ack_nack
(
state
,
socket_fd
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/sender_utils.c
+
9
−
6
Voir le fichier @
25a92034
...
@@ -114,15 +114,17 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd)
...
@@ -114,15 +114,17 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd)
// Handling NACK:
// Handling NACK:
if
(
pkt_type
==
PTYPE_NACK
)
if
(
pkt_type
==
PTYPE_NACK
)
{
{
if
(
state
->
map_seqnum_to_buffer_place
[
seqnum
]
==
OUT_OFF_WINDOW
)
uint8_t
place
=
state
->
map_seqnum_to_buffer_place
[
seqnum
];
if
(
place
==
OUT_OFF_WINDOW
)
{
{
DEBUG
(
"The NACK with the seqnum: %d is out of the sended window so it has been discarded"
,
seqnum
);
DEBUG
(
"The NACK with the seqnum: %d is out of the sended window so it has been discarded"
,
seqnum
);
}
}
else
else
{
{
DEBUG
(
"The NACK with the seqnum: %d has been received"
,
seqnum
);
DEBUG
(
"The NACK with the seqnum: %d has been received, so the pkt will be sent back"
,
seqnum
);
state
->
r_window_size
=
r_window
;
state
->
r_window_size
=
r_window
-
1
;
// -1 Because the receiver doesn't count yet the sended pkt
if
(
send_pkt
(
state
,
pkt
,
seqnum
,
socket_fd
)
==
-
1
)
return
-
1
;
pkt_t
*
n_pkt
=
state
->
buffer
[
place
];
if
(
send_pkt
(
state
,
n_pkt
,
place
,
socket_fd
)
==
-
1
)
return
-
1
;
}
}
}
}
// Handling ACK:
// Handling ACK:
...
@@ -153,13 +155,14 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd)
...
@@ -153,13 +155,14 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd)
return
0
;
return
0
;
}
}
}
}
// Some pkt need to be acked
// Some pkt need to be ack
nowledg
ed
else
else
{
{
state
->
r_window_size
=
r_window
;
state
->
r_window_size
=
r_window
;
uint8_t
upper_bound
=
(
place_last_ack
+
1
)
%
WINDOW_SIZE
;
// The oldest seqnum sended
uint8_t
upper_bound
=
(
place_last_ack
+
1
)
%
WINDOW_SIZE
;
// The oldest seqnum sended
DEBUG
(
"The sender is cumulatively acknowledging [%d : %d[ (place in the buffer)"
,
state
->
tail
,
upper_bound
);
DEBUG
(
"The sender is cumulatively acknowledging [%d : %d[ (place in the buffer) | [%d, %d[ (seqnum)"
,
state
->
tail
,
upper_bound
,
pkt_get_seqnum
(
state
->
buffer
[
state
->
tail
]),
seqnum_nack
);
// A do while is necessary here in case we want to make a full revolution (ack from 1 to 1 not included for example)
// A do while is necessary here in case we want to make a full revolution (ack from 1 to 1 not included for example)
do
do
{
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter