diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-12 14:58:31 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-12 14:58:31 +0000 |
commit | f2cfcd5b55fb441a5cd76c4508be48c85d2b93b1 (patch) | |
tree | 47b685bf218dc7838beaabafffabd85a194b616a /src/testbed | |
parent | a880ba0d8eaa854c5bbff9f51e467a18c3ca6201 (diff) | |
download | gnunet-f2cfcd5b55fb441a5cd76c4508be48c85d2b93b1.tar.gz gnunet-f2cfcd5b55fb441a5cd76c4508be48c85d2b93b1.zip |
fixes
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 11 | ||||
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 7 | ||||
-rw-r--r-- | src/testbed/testbed_api.c | 6 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 44eb19e23..d8d2661cc 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c | |||
@@ -1479,12 +1479,15 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client, | |||
1479 | 1479 | ||
1480 | msg = (const struct GNUNET_TESTBED_AddHostMessage *) message; | 1480 | msg = (const struct GNUNET_TESTBED_AddHostMessage *) message; |
1481 | msize = ntohs (msg->header.size); | 1481 | msize = ntohs (msg->header.size); |
1482 | username = (char *) &(msg[1]); | 1482 | username = (char *) &msg[1]; |
1483 | username_length = ntohs (msg->user_name_length); | 1483 | username_length = ntohs (msg->user_name_length); |
1484 | GNUNET_assert (msize > (sizeof (struct GNUNET_TESTBED_AddHostMessage) + username_length + 1)); /* msg must contain hostname */ | ||
1485 | if (0 != username_length) | 1484 | if (0 != username_length) |
1486 | GNUNET_assert ('\0' == username[username_length]); | 1485 | username_length++; |
1487 | username_length = (0 == username_length) ? 0 : username_length + 1; | 1486 | /* msg must contain hostname */ |
1487 | GNUNET_assert (msize > (sizeof (struct GNUNET_TESTBED_AddHostMessage) + | ||
1488 | username_length + 1)); | ||
1489 | if (0 != username_length) | ||
1490 | GNUNET_assert ('\0' == username[username_length - 1]); | ||
1488 | hostname = username + username_length; | 1491 | hostname = username + username_length; |
1489 | hostname_length = | 1492 | hostname_length = |
1490 | msize - (sizeof (struct GNUNET_TESTBED_AddHostMessage) + username_length); | 1493 | msize - (sizeof (struct GNUNET_TESTBED_AddHostMessage) + username_length); |
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 4247bbebf..0191580c4 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -252,14 +252,15 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
252 | { | 252 | { |
253 | static unsigned int reg_host; | 253 | static unsigned int reg_host; |
254 | 254 | ||
255 | register_hosts_task = GNUNET_SCHEDULER_NO_TASK; | 255 | register_hosts_task = GNUNET_SCHEDULER_NO_TASK; |
256 | if (reg_host == num_hosts) | 256 | if (reg_host == num_hosts - 1) |
257 | { | 257 | { |
258 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 258 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
259 | "All hosts successfully registered\n"); | 259 | "All hosts successfully registered\n"); |
260 | /* Start peer create task */ | 260 | /* Start peer create task */ |
261 | return; | ||
261 | } | 262 | } |
262 | reg_handle = GNUNET_TESTBED_register_host (mc, hosts[reg_host++], | 263 | reg_handle = GNUNET_TESTBED_register_host (mc, hosts[++reg_host], |
263 | host_registration_completion, | 264 | host_registration_completion, |
264 | NULL); | 265 | NULL); |
265 | } | 266 | } |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 7cd536497..053d730ff 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -1780,9 +1780,13 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, | |||
1780 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST); | 1780 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST); |
1781 | msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host)); | 1781 | msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host)); |
1782 | msg->ssh_port = htons (GNUNET_TESTBED_host_get_ssh_port_ (host)); | 1782 | msg->ssh_port = htons (GNUNET_TESTBED_host_get_ssh_port_ (host)); |
1783 | msg->user_name_length = htons (user_name_length); | ||
1784 | if (NULL != username) | 1783 | if (NULL != username) |
1784 | { | ||
1785 | msg->user_name_length = htons (user_name_length - 1); | ||
1785 | memcpy (&msg[1], username, user_name_length); | 1786 | memcpy (&msg[1], username, user_name_length); |
1787 | } | ||
1788 | else | ||
1789 | msg->user_name_length = htons (user_name_length); | ||
1786 | strcpy (((void *) &msg[1]) + user_name_length, hostname); | 1790 | strcpy (((void *) &msg[1]) + user_name_length, hostname); |
1787 | GNUNET_TESTBED_queue_message_ (controller, | 1791 | GNUNET_TESTBED_queue_message_ (controller, |
1788 | (struct GNUNET_MessageHeader *) msg); | 1792 | (struct GNUNET_MessageHeader *) msg); |