Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r1145 committed - small code refactoring

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r1145 committed - small code refactoring


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r1145 committed - small code refactoring
  • Date: Fri, 07 Nov 2014 08:59:09 +0000

Revision: 1145
Author:

Date: Fri Nov 7 08:58:59 2014 UTC
Log: small code refactoring
https://code.google.com/p/ndt/source/detail?r=1145

Modified:
/branches/MultiplePorts/src/test_c2s_clt.c

=======================================
--- /branches/MultiplePorts/src/test_c2s_clt.c Thu Nov 6 09:42:49 2014 UTC
+++ /branches/MultiplePorts/src/test_c2s_clt.c Fri Nov 7 08:58:59 2014 UTC
@@ -265,35 +265,18 @@
}
buff[msgLen] = 0;

- // get C->S test speed as calculated by server
+ // get C->S test speed as calculated by server
if (json_check_msg(buff) == 0) {
jsonMsgValue = json_read_map_value(buff, DEFAULT_KEY);
- c2sspd = atoi(jsonMsgValue);
-#ifdef EXTTESTS_ENABLED
- if (throughputsnaps != NULL) {
- char* strtokptr = strtok(jsonMsgValue, " ");
- while ((strtokptr = strtok(NULL, " ")) != NULL) {
- if (lastThroughputSnapshot != NULL) {
- lastThroughputSnapshot->next = (struct throughputSnapshot*) malloc(sizeof(struct throughputSnapshot));
- lastThroughputSnapshot = lastThroughputSnapshot->next;
- }
- else {
- uThroughputSnapshots = lastThroughputSnapshot = (struct throughputSnapshot*) malloc(sizeof(struct throughputSnapshot));
- }
- lastThroughputSnapshot->next = NULL;
- lastThroughputSnapshot->time = atof(strtokptr);
- strtokptr = strtok(NULL, " ");
- lastThroughputSnapshot->throughput = atof(strtokptr);
- }
- }
-#endif
+ strlcpy(buff, jsonMsgValue, sizeof(buff));
+ msgLen = strlen(buff);
free(jsonMsgValue);
}
- else {
- c2sspd = atoi(buff);
+
+ c2sspd = atoi(buff);
#ifdef EXTTESTS_ENABLED
if (throughputsnaps != NULL) {
- char* strtokptr = strtok(buff, " ");
+ char* strtokptr = strtok(jsonMsgValue, " ");
while ((strtokptr = strtok(NULL, " ")) != NULL) {
if (lastThroughputSnapshot != NULL) {
lastThroughputSnapshot->next = (struct throughputSnapshot*) malloc(sizeof(struct throughputSnapshot));
@@ -309,7 +292,6 @@
}
}
#endif
- }

// Print results in the most convenient units (kbps or Mbps)
if (c2sspd < KILO)


  • [ndt-dev] [ndt] r1145 committed - small code refactoring, ndt, 11/07/2014

Archive powered by MHonArc 2.6.16.

Top of Page