aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-10-02 03:37:35 +0000
committerBart Polot <bart@net.in.tum.de>2015-10-02 03:37:35 +0000
commite1363dfe350cd166cf6ecaef63f46db3737e958b (patch)
treee4df59ca3dcd87a49c77dad3b6b426b241789513 /src/cadet
parent724a27aba96c2ddb032f642930a750a8156be0fb (diff)
downloadgnunet-e1363dfe350cd166cf6ecaef63f46db3737e958b.tar.gz
gnunet-e1363dfe350cd166cf6ecaef63f46db3737e958b.zip
- use better variable names
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c32
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c12
2 files changed, 22 insertions, 22 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index b0eb6e526..667ff2b9c 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -404,7 +404,7 @@ static void
404core_connect (void *cls, 404core_connect (void *cls,
405 const struct GNUNET_PeerIdentity *peer) 405 const struct GNUNET_PeerIdentity *peer)
406{ 406{
407 struct CadetPeer *mp; 407 struct CadetPeer *neighbor;
408 struct CadetPeerPath *path; 408 struct CadetPeerPath *path;
409 char own_id[16]; 409 char own_id[16];
410 410
@@ -413,8 +413,8 @@ core_connect (void *cls,
413 sizeof (own_id), 413 sizeof (own_id),
414 "%s", 414 "%s",
415 GNUNET_i2s (&my_full_id)); 415 GNUNET_i2s (&my_full_id));
416 mp = GCP_get (peer, GNUNET_YES); 416 neighbor = GCP_get (peer, GNUNET_YES);
417 if (myid == mp->id) 417 if (myid == neighbor->id)
418 { 418 {
419 LOG (GNUNET_ERROR_TYPE_INFO, 419 LOG (GNUNET_ERROR_TYPE_INFO,
420 "CONNECTED %s (self)\n", 420 "CONNECTED %s (self)\n",
@@ -428,22 +428,22 @@ core_connect (void *cls,
428 own_id, 428 own_id,
429 GNUNET_i2s (peer)); 429 GNUNET_i2s (peer));
430 path = path_new (2); 430 path = path_new (2);
431 path->peers[1] = mp->id; 431 path->peers[1] = neighbor->id;
432 GNUNET_PEER_change_rc (mp->id, 1); 432 GNUNET_PEER_change_rc (neighbor->id, 1);
433 } 433 }
434 path->peers[0] = myid; 434 path->peers[0] = myid;
435 GNUNET_PEER_change_rc (myid, 1); 435 GNUNET_PEER_change_rc (myid, 1);
436 GCP_add_path (mp, path, GNUNET_YES); 436 GCP_add_path (neighbor, path, GNUNET_YES);
437 GNUNET_STATISTICS_update (stats, 437 GNUNET_STATISTICS_update (stats,
438 "# peers", 438 "# peers",
439 1, 439 1,
440 GNUNET_NO); 440 GNUNET_NO);
441 GNUNET_assert (NULL == mp->connections); 441 GNUNET_assert (NULL == neighbor->connections);
442 mp->connections = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); 442 neighbor->connections = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO);
443 443
444 if ( (NULL != GCP_get_tunnel (mp)) && 444 if ( (NULL != GCP_get_tunnel (neighbor)) &&
445 (0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) ) 445 (0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) )
446 GCP_connect (mp); 446 GCP_connect (neighbor);
447 GCC_check_connections (); 447 GCC_check_connections ();
448} 448}
449 449
@@ -1900,7 +1900,7 @@ void
1900GCP_connect (struct CadetPeer *peer) 1900GCP_connect (struct CadetPeer *peer)
1901{ 1901{
1902 struct CadetTunnel *t; 1902 struct CadetTunnel *t;
1903 struct CadetPeerPath *p; 1903 struct CadetPeerPath *path;
1904 struct CadetConnection *c; 1904 struct CadetConnection *c;
1905 int rerun_search; 1905 int rerun_search;
1906 1906
@@ -1917,16 +1917,16 @@ GCP_connect (struct CadetPeer *peer)
1917 if (NULL != peer->path_head) 1917 if (NULL != peer->path_head)
1918 { 1918 {
1919 LOG (GNUNET_ERROR_TYPE_DEBUG, " some path exists\n"); 1919 LOG (GNUNET_ERROR_TYPE_DEBUG, " some path exists\n");
1920 p = peer_get_best_path (peer); 1920 path = peer_get_best_path (peer);
1921 if (NULL != p) 1921 if (NULL != path)
1922 { 1922 {
1923 char *s; 1923 char *s;
1924 1924
1925 s = path_2s (p); 1925 s = path_2s (path);
1926 LOG (GNUNET_ERROR_TYPE_DEBUG, " path to use: %s\n", s); 1926 LOG (GNUNET_ERROR_TYPE_DEBUG, " path to use: %s\n", s);
1927 GNUNET_free (s); 1927 GNUNET_free (s);
1928 1928
1929 c = GCT_use_path (t, p); 1929 c = GCT_use_path (t, path);
1930 if (NULL == c) 1930 if (NULL == c)
1931 { 1931 {
1932 /* This case can happen when the path includes a first hop that is 1932 /* This case can happen when the path includes a first hop that is
@@ -1935,7 +1935,7 @@ GCP_connect (struct CadetPeer *peer)
1935 * This happens quite often during testing when running cadet 1935 * This happens quite often during testing when running cadet
1936 * under valgrind: core connect notifications come very late 1936 * under valgrind: core connect notifications come very late
1937 * and the DHT result has already come and created a valid 1937 * and the DHT result has already come and created a valid
1938 * path. In this case, the peer->connections_{pred,succ} 1938 * path. In this case, the peer->connections
1939 * hashmaps will be NULL and tunnel_use_path will not be able 1939 * hashmaps will be NULL and tunnel_use_path will not be able
1940 * to create a connection from that path. 1940 * to create a connection from that path.
1941 * 1941 *
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 920ea9294..6a809ccad 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -3824,13 +3824,13 @@ GCT_destroy (struct CadetTunnel *t)
3824 * @return Connection created. 3824 * @return Connection created.
3825 */ 3825 */
3826struct CadetConnection * 3826struct CadetConnection *
3827GCT_use_path (struct CadetTunnel *t, struct CadetPeerPath *p) 3827GCT_use_path (struct CadetTunnel *t, struct CadetPeerPath *path)
3828{ 3828{
3829 struct CadetConnection *c; 3829 struct CadetConnection *c;
3830 struct GNUNET_CADET_Hash cid; 3830 struct GNUNET_CADET_Hash cid;
3831 unsigned int own_pos; 3831 unsigned int own_pos;
3832 3832
3833 if (NULL == t || NULL == p) 3833 if (NULL == t || NULL == path)
3834 { 3834 {
3835 GNUNET_break (0); 3835 GNUNET_break (0);
3836 return NULL; 3836 return NULL;
@@ -3842,19 +3842,19 @@ GCT_use_path (struct CadetTunnel *t, struct CadetPeerPath *p)
3842 return NULL; 3842 return NULL;
3843 } 3843 }
3844 3844
3845 for (own_pos = 0; own_pos < p->length; own_pos++) 3845 for (own_pos = 0; own_pos < path->length; own_pos++)
3846 { 3846 {
3847 if (p->peers[own_pos] == myid) 3847 if (path->peers[own_pos] == myid)
3848 break; 3848 break;
3849 } 3849 }
3850 if (own_pos >= p->length) 3850 if (own_pos >= path->length)
3851 { 3851 {
3852 GNUNET_break_op (0); 3852 GNUNET_break_op (0);
3853 return NULL; 3853 return NULL;
3854 } 3854 }
3855 3855
3856 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &cid, sizeof (cid)); 3856 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &cid, sizeof (cid));
3857 c = GCC_new (&cid, t, p, own_pos); 3857 c = GCC_new (&cid, t, path, own_pos);
3858 if (NULL == c) 3858 if (NULL == c)
3859 { 3859 {
3860 /* Path was flawed */ 3860 /* Path was flawed */