diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-01-30 02:11:15 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-01-30 02:11:15 +0000 |
commit | e43078b68951ad8a3daa3a193473e9c321549e1d (patch) | |
tree | f619430b7198993cc9fd55af2973ad426664f90f /src | |
parent | 4cf7d45ccd42e8d2534c631046b4c621ec50a368 (diff) | |
download | gnunet-e43078b68951ad8a3daa3a193473e9c321549e1d.tar.gz gnunet-e43078b68951ad8a3daa3a193473e9c321549e1d.zip |
- use variables to cound ch, conns
- use ntohs for tunnel state
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/mesh_api.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index c1088054a..0ff46f01c 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -1089,6 +1089,8 @@ process_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
1089 | struct GNUNET_MESH_LocalInfoTunnel *msg; | 1089 | struct GNUNET_MESH_LocalInfoTunnel *msg; |
1090 | size_t esize; | 1090 | size_t esize; |
1091 | size_t msize; | 1091 | size_t msize; |
1092 | unsigned int ch_n; | ||
1093 | unsigned int c_n; | ||
1092 | 1094 | ||
1093 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n"); | 1095 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n"); |
1094 | if (NULL == h->tunnel_cb) | 1096 | if (NULL == h->tunnel_cb) |
@@ -1107,23 +1109,26 @@ process_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
1107 | h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, 0, 0); | 1109 | h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, 0, 0); |
1108 | goto clean_cls; | 1110 | goto clean_cls; |
1109 | } | 1111 | } |
1110 | esize += ntohl (msg->connections) * sizeof (struct GNUNET_HashCode); | 1112 | ch_n = ntohl (msg->channels); |
1111 | esize += ntohl (msg->channels) * sizeof (MESH_ChannelNumber); | 1113 | c_n = ntohl (msg->connections); |
1114 | esize += ch_n * sizeof (MESH_ChannelNumber); | ||
1115 | esize += c_n * sizeof (struct GNUNET_HashCode); | ||
1112 | if (msize != esize) | 1116 | if (msize != esize) |
1113 | { | 1117 | { |
1114 | GNUNET_break_op (0); | 1118 | GNUNET_break_op (0); |
1115 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "e: %u, m:%u\n", esize, msize); | 1119 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n", |
1120 | msize, esize, ch_n, c_n); | ||
1121 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n", | ||
1122 | sizeof (struct GNUNET_MESH_LocalInfoTunnel), | ||
1123 | sizeof (MESH_ChannelNumber), sizeof (struct GNUNET_HashCode)); | ||
1116 | h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, 0, 0); | 1124 | h->tunnel_cb (h->tunnel_cls, NULL, 0, 0, 0, 0); |
1117 | goto clean_cls; | 1125 | goto clean_cls; |
1118 | } | 1126 | } |
1119 | 1127 | ||
1120 | /* Call Callback with tunnel info. */ | 1128 | /* Call Callback with tunnel info. */ |
1121 | h->tunnel_cb (h->tunnel_cls, | 1129 | h->tunnel_cb (h->tunnel_cls, &msg->destination, |
1122 | &msg->destination, | 1130 | ch_n, c_n, |
1123 | ntohl (msg->channels), | 1131 | ntohs (msg->estate), ntohs (msg->cstate)); |
1124 | ntohl (msg->connections), | ||
1125 | ntohl (msg->estate), | ||
1126 | ntohl (msg->cstate)); | ||
1127 | 1132 | ||
1128 | clean_cls: | 1133 | clean_cls: |
1129 | h->tunnel_cb = NULL; | 1134 | h->tunnel_cb = NULL; |