diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-08 15:34:45 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-08 15:34:45 +0000 |
commit | 19b4dacf08575bd188f9010558e8299c6c8eb56e (patch) | |
tree | 1555b7c5ac0e6a4ac39028830a50086c70d19830 /src/testbed/testbed_api_topology.c | |
parent | 6419502e4bb83f53caf9f3fd5170f8219516e38a (diff) | |
download | gnunet-19b4dacf08575bd188f9010558e8299c6c8eb56e.tar.gz gnunet-19b4dacf08575bd188f9010558e8299c6c8eb56e.zip |
- fix (case where peers <= 2)
Diffstat (limited to 'src/testbed/testbed_api_topology.c')
-rw-r--r-- | src/testbed/testbed_api_topology.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index 6bb1e5d73..c68d336e5 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c | |||
@@ -429,6 +429,8 @@ gen_topo_ring (struct TopologyContext *tc) | |||
429 | * @param rows number of rows in the 2d torus. Can be NULL | 429 | * @param rows number of rows in the 2d torus. Can be NULL |
430 | * @param rows_len the length of each row. This array will be allocated | 430 | * @param rows_len the length of each row. This array will be allocated |
431 | * fresh. The caller should free it. Can be NULL | 431 | * fresh. The caller should free it. Can be NULL |
432 | * @return the number of links that are required to generate a 2d torus for the | ||
433 | * given number of peers | ||
432 | */ | 434 | */ |
433 | unsigned int | 435 | unsigned int |
434 | GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers, unsigned int *rows, | 436 | GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers, unsigned int *rows, |
@@ -451,7 +453,7 @@ GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers, unsigned int *rows, | |||
451 | for (y = 0; y < _rows - 1; y++) | 453 | for (y = 0; y < _rows - 1; y++) |
452 | _rows_len[y] = sq_floor; | 454 | _rows_len[y] = sq_floor; |
453 | _num_peers = sq_floor * sq_floor; | 455 | _num_peers = sq_floor * sq_floor; |
454 | cnt = 2 * _num_peers; | 456 | cnt = (_num_peers < 2) ? _num_peers : 2 * _num_peers; |
455 | x = 0; | 457 | x = 0; |
456 | y = 0; | 458 | y = 0; |
457 | while (_num_peers < num_peers) | 459 | while (_num_peers < num_peers) |