aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_cp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-30 17:26:45 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-30 17:26:45 +0000
commit2e6e4ee945072c30c24289da5d01aed1b282dfcd (patch)
tree2c8bfc2183657fc03dfc08a3d67b11e3a8eeda56 /src/fs/gnunet-service-fs_cp.c
parent7398e127e6b600054c20deafb3fae075adeafd8f (diff)
downloadgnunet-2e6e4ee945072c30c24289da5d01aed1b282dfcd.tar.gz
gnunet-2e6e4ee945072c30c24289da5d01aed1b282dfcd.zip
fixing #3146: peer identities no longer have the size of hash codes; breaks FS protocol compatibility with previous versions slightly...
Diffstat (limited to 'src/fs/gnunet-service-fs_cp.c')
-rw-r--r--src/fs/gnunet-service-fs_cp.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 593250e2c..a586ea503 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -98,7 +98,7 @@ struct GSF_PeerTransmitHandle
98 struct GSF_ConnectedPeer *cp; 98 struct GSF_ConnectedPeer *cp;
99 99
100 /** 100 /**
101 * Closure for 'gmc'. 101 * Closure for @e gmc.
102 */ 102 */
103 void *gmc_cls; 103 void *gmc_cls;
104 104
@@ -108,7 +108,7 @@ struct GSF_PeerTransmitHandle
108 size_t size; 108 size_t size;
109 109
110 /** 110 /**
111 * GNUNET_YES if this is a query, GNUNET_NO for content. 111 * #GNUNET_YES if this is a query, #GNUNET_NO for content.
112 */ 112 */
113 int is_query; 113 int is_query;
114 114
@@ -1116,7 +1116,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1116 uint16_t msize; 1116 uint16_t msize;
1117 const struct GetMessage *gm; 1117 const struct GetMessage *gm;
1118 unsigned int bits; 1118 unsigned int bits;
1119 const struct GNUNET_HashCode *opt; 1119 const struct GNUNET_PeerIdentity *opt;
1120 uint32_t bm; 1120 uint32_t bm;
1121 size_t bfsize; 1121 size_t bfsize;
1122 uint32_t ttl_decrement; 1122 uint32_t ttl_decrement;
@@ -1146,13 +1146,13 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1146 bits++; 1146 bits++;
1147 bm >>= 1; 1147 bm >>= 1;
1148 } 1148 }
1149 if (msize < sizeof (struct GetMessage) + bits * sizeof (struct GNUNET_HashCode)) 1149 if (msize < sizeof (struct GetMessage) + bits * sizeof (struct GNUNET_PeerIdentity))
1150 { 1150 {
1151 GNUNET_break_op (0); 1151 GNUNET_break_op (0);
1152 return NULL; 1152 return NULL;
1153 } 1153 }
1154 opt = (const struct GNUNET_HashCode *) &gm[1]; 1154 opt = (const struct GNUNET_PeerIdentity *) &gm[1];
1155 bfsize = msize - sizeof (struct GetMessage) - bits * sizeof (struct GNUNET_HashCode); 1155 bfsize = msize - sizeof (struct GetMessage) - bits * sizeof (struct GNUNET_PeerIdentity);
1156 /* bfsize must be power of 2, check! */ 1156 /* bfsize must be power of 2, check! */
1157 if (0 != ((bfsize - 1) & bfsize)) 1157 if (0 != ((bfsize - 1) & bfsize))
1158 { 1158 {
@@ -1173,7 +1173,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1173 return NULL; 1173 return NULL;
1174 } 1174 }
1175 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO)) 1175 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO))
1176 cp = GSF_peer_get_ ((const struct GNUNET_PeerIdentity *) &opt[bits++]); 1176 cp = GSF_peer_get_ (&opt[bits++]);
1177 else 1177 else
1178 cp = cps; 1178 cp = cps;
1179 if (NULL == cp) 1179 if (NULL == cp)
@@ -1181,8 +1181,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1181 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO)) 1181 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO))
1182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1183 "Failed to find RETURN-TO peer `%4s' in connection set. Dropping query.\n", 1183 "Failed to find RETURN-TO peer `%4s' in connection set. Dropping query.\n",
1184 GNUNET_i2s ((const struct GNUNET_PeerIdentity *) 1184 GNUNET_i2s (&opt[bits - 1]));
1185 &opt[bits - 1]));
1186 1185
1187 else 1186 else
1188 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1209,12 +1208,13 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1209 } 1208 }
1210 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1209 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1211 "Received request for `%s' of type %u from peer `%4s' with flags %u\n", 1210 "Received request for `%s' of type %u from peer `%4s' with flags %u\n",
1212 GNUNET_h2s (&gm->query), (unsigned int) type, GNUNET_i2s (other), 1211 GNUNET_h2s (&gm->query),
1212 (unsigned int) type,
1213 GNUNET_i2s (other),
1213 (unsigned int) bm); 1214 (unsigned int) bm);
1214 target = 1215 target =
1215 (0 != 1216 (0 !=
1216 (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? ((const struct GNUNET_PeerIdentity 1217 (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? (&opt[bits++]) : NULL;
1217 *) &opt[bits++]) : NULL;
1218 options = GSF_PRO_DEFAULTS; 1218 options = GSF_PRO_DEFAULTS;
1219 spid = 0; 1219 spid = 0;
1220 if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) 1220 if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority))