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
7b98416e
Valider
7b98416e
rédigé
3 years ago
par
Vany Ingenzi
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Corrected the write stats functions
parent
5a2574f8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
4
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
4 fichiers modifiés
src/our_utils.c
+18
-16
18 ajouts, 16 suppressions
src/our_utils.c
src/our_utils.h
+9
-5
9 ajouts, 5 suppressions
src/our_utils.h
src/receiver_utils.c
+1
-1
1 ajout, 1 suppression
src/receiver_utils.c
src/sender_utils.c
+1
-1
1 ajout, 1 suppression
src/sender_utils.c
avec
29 ajouts
et
23 suppressions
src/our_utils.c
+
18
−
16
Voir le fichier @
7b98416e
...
@@ -109,7 +109,7 @@ int wait_for_client(int sfd)
...
@@ -109,7 +109,7 @@ int wait_for_client(int sfd)
return
0
;
return
0
;
}
}
void
write_stats_to_file
(
const
char
*
pathname
,
transfer_stats_t
*
stats_file
)
void
write_stats_to_file
(
const
char
*
pathname
,
transfer_stats_t
*
stats_file
,
agents_t
caller
)
{
{
if
(
pathname
==
NULL
||
stats_file
==
NULL
)
if
(
pathname
==
NULL
||
stats_file
==
NULL
)
return
;
return
;
...
@@ -150,25 +150,27 @@ void write_stats_to_file(const char * pathname, transfer_stats_t * stats_file)
...
@@ -150,25 +150,27 @@ void write_stats_to_file(const char * pathname, transfer_stats_t * stats_file)
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_ignored:%llu
\n
"
,
stats_file
->
packet_ignored
);
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_ignored:%llu
\n
"
,
stats_file
->
packet_ignored
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
#ifdef __RECEIVER_UTILS_
if
(
caller
==
RECEIVER
)
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_duplicated:%llu
\n
"
,
stats_file
->
packet_duplicated
);
{
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_duplicated:%llu
\n
"
,
stats_file
->
packet_duplicated
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_recovered:%llu
\n
"
,
stats_file
->
packet_recovered
);
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_recovered:%llu
\n
"
,
stats_file
->
packet_recovered
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
#endif
}
#ifdef __SENDER_UTILS_H_
ret
=
sprintf
((
char
*
)
&
buffer
,
"min_rtt:%llu ms
\n
"
,
stats_file
->
min_rtt
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
sprintf
((
char
*
)
&
buffer
,
"max_rtt:%llu ms
\n
"
,
stats_file
->
max_rtt
);
if
(
caller
==
SENDER
)
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
{
ret
=
sprintf
((
char
*
)
&
buffer
,
"min_rtt:%llu ms
\n
"
,
stats_file
->
min_rtt
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_retransmitted:%llu
\n
"
,
stats_file
->
packet_retransmitted
);
ret
=
sprintf
((
char
*
)
&
buffer
,
"max_rtt:%llu ms
\n
"
,
stats_file
->
max_rtt
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
#endif
ret
=
sprintf
((
char
*
)
&
buffer
,
"packet_retransmitted:%llu
\n
"
,
stats_file
->
packet_retransmitted
);
ret
=
write
(
fd
,
buffer
,
strlen
(
buffer
));
}
close
(
fd
);
close
(
fd
);
ret
--
;
// dump
ret
--
;
// dump
DEBUG
(
"Wrote the transfer statistics to %s."
,
pathname
);
DEBUG
(
"Wrote the transfer statistics to %s."
,
pathname
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/our_utils.h
+
9
−
5
Voir le fichier @
7b98416e
...
@@ -30,17 +30,19 @@ typedef struct __attribute__((__packed__))
...
@@ -30,17 +30,19 @@ typedef struct __attribute__((__packed__))
unsigned
long
long
int
nack_sent
;
unsigned
long
long
int
nack_sent
;
unsigned
long
long
int
nack_received
;
unsigned
long
long
int
nack_received
;
unsigned
long
long
int
packet_ignored
;
unsigned
long
long
int
packet_ignored
;
#ifdef __RECEIVER_UTILS_
unsigned
long
long
int
packet_duplicated
;
unsigned
long
long
int
packet_duplicated
;
unsigned
long
long
int
packet_recovered
;
unsigned
long
long
int
packet_recovered
;
#endif
#ifdef __SENDER_UTILS_H_
unsigned
long
long
int
min_rtt
;
unsigned
long
long
int
min_rtt
;
unsigned
long
long
int
max_rtt
;
unsigned
long
long
int
max_rtt
;
unsigned
long
long
int
packet_retransmitted
;
unsigned
long
long
int
packet_retransmitted
;
#endif
}
transfer_stats_t
;
}
transfer_stats_t
;
/* The type of agents */
typedef
enum
{
SENDER
,
RECEIVER
,
}
agents_t
;
/**
/**
* @brief Resolve the resource name to an usable IPv6 address
* @brief Resolve the resource name to an usable IPv6 address
...
@@ -83,9 +85,11 @@ int wait_for_client(int sfd);
...
@@ -83,9 +85,11 @@ int wait_for_client(int sfd);
*
*
* @param pathname: The pathname to the stats file.
* @param pathname: The pathname to the stats file.
* @param stats_file: Pointer to the stats file output.
* @param stats_file: Pointer to the stats file output.
* @param caller: To know the caller of the function.
*
*
*
* @returns In case of an error it is printed on the stderr.
* @returns In case of an error it is printed on the stderr.
*/
*/
void
write_stats_to_file
(
const
char
*
pathname
,
transfer_stats_t
*
stats_file
);
void
write_stats_to_file
(
const
char
*
pathname
,
transfer_stats_t
*
stats_file
,
agents_t
caller
);
#endif
#endif
\ No newline at end of file
Ce diff est replié.
Cliquez pour l'agrandir.
src/receiver_utils.c
+
1
−
1
Voir le fichier @
7b98416e
...
@@ -650,7 +650,7 @@ void receiver_read_write_loop(int sfd, const char * pathname)
...
@@ -650,7 +650,7 @@ void receiver_read_write_loop(int sfd, const char * pathname)
reception_loop
(
pfd
,
state
);
reception_loop
(
pfd
,
state
);
DEBUG
(
"Done the transfer with done status being %s"
,
(
state
->
transfer_done
)
?
"true"
:
"false"
);
DEBUG
(
"Done the transfer with done status being %s"
,
(
state
->
transfer_done
)
?
"true"
:
"false"
);
write_stats_to_file
(
pathname
,
state
->
stats
);
write_stats_to_file
(
pathname
,
state
->
stats
,
RECEIVER
);
state_del
(
state
);
state_del
(
state
);
free
(
pfd
);
free
(
pfd
);
}
}
\ No newline at end of file
Ce diff est replié.
Cliquez pour l'agrandir.
src/sender_utils.c
+
1
−
1
Voir le fichier @
7b98416e
...
@@ -39,7 +39,7 @@ sender_state_t *state_new(bool fec_enabled)
...
@@ -39,7 +39,7 @@ sender_state_t *state_new(bool fec_enabled)
void
state_del
(
sender_state_t
*
state
,
const
char
*
pathname
)
void
state_del
(
sender_state_t
*
state
,
const
char
*
pathname
)
{
{
write_stats_to_file
(
pathname
,
state
->
stats
);
write_stats_to_file
(
pathname
,
state
->
stats
,
SENDER
);
// To be sure, we free the pkt that might not have been freed (in case of an error or timeout)
// To be sure, we free the pkt that might not have been freed (in case of an error or timeout)
for
(
uint8_t
i
=
0
;
i
<
WINDOW_SIZE
;
i
++
)
for
(
uint8_t
i
=
0
;
i
<
WINDOW_SIZE
;
i
++
)
...
...
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