diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-09-05 16:54:38 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-09-05 16:54:38 +0000 |
commit | 2f3fe3f930f2c6088ba2d151943afbc4fbc086ea (patch) | |
tree | 8ef31fc0986632c73ff4024f2229699c8a7f640e /src/cadet | |
parent | 8bf733ee62bba44c51e1d26d79a6e44c66ba15c2 (diff) | |
download | gnunet-2f3fe3f930f2c6088ba2d151943afbc4fbc086ea.tar.gz gnunet-2f3fe3f930f2c6088ba2d151943afbc4fbc086ea.zip |
- check path length, simplify error conditions
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 4ec029386..41a6fdd92 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -1858,13 +1858,8 @@ GCP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, | |||
1858 | LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", | 1858 | LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", |
1859 | path->length, GCP_2s (peer)); | 1859 | path->length, GCP_2s (peer)); |
1860 | 1860 | ||
1861 | if ((NULL == peer) || (NULL == path)) | 1861 | if (NULL == peer || NULL == path |
1862 | { | 1862 | || path->peers[path->length - 1] != peer->id) |
1863 | GNUNET_break (0); | ||
1864 | path_destroy (path); | ||
1865 | return NULL; | ||
1866 | } | ||
1867 | if (path->peers[path->length - 1] != peer->id) | ||
1868 | { | 1863 | { |
1869 | GNUNET_break (0); | 1864 | GNUNET_break (0); |
1870 | path_destroy (path); | 1865 | path_destroy (path); |
@@ -2010,7 +2005,8 @@ GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) | |||
2010 | { | 2005 | { |
2011 | next = iter->next; | 2006 | next = iter->next; |
2012 | if (0 == memcmp (path->peers, iter->peers, | 2007 | if (0 == memcmp (path->peers, iter->peers, |
2013 | sizeof (GNUNET_PEER_Id) * path->length)) | 2008 | sizeof (GNUNET_PEER_Id) * path->length) |
2009 | && iter->length == path->length) | ||
2014 | { | 2010 | { |
2015 | GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, iter); | 2011 | GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, iter); |
2016 | if (iter != path) | 2012 | if (iter != path) |