| … | … | @@ -185,8 +185,11 @@ uint32_t DhtRpc::query(const uint8_t *target, bool internal, uint32_t command, |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | _queries[_query_count++] = q; |
| 188 | // _advance_query may COMPLETE — and delete — a query with no one to ask (an empty |
| 189 | // routing table: an announce at startup). Take the id first. |
| 190 | const uint32_t id = q->id; |
| 188 | 191 | _advance_query(q); |
| 189 | | return q->id; |
| 192 | return id; |
| 190 | 193 | } |
| 191 | 194 | |
| 192 | 195 | uint32_t DhtRpc::query_with_commit(const uint8_t *target, bool internal, |
| … | … | @@ -227,8 +230,11 @@ uint32_t DhtRpc::query_with_commit(const uint8_t *target, bool internal, |
| 227 | 230 | } |
| 228 | 231 | |
| 229 | 232 | _queries[_query_count++] = q; |
| 233 | // _advance_query may COMPLETE — and delete — a query with no one to ask (an empty |
| 234 | // routing table: an announce at startup). Take the id first. |
| 235 | const uint32_t id = q->id; |
| 230 | 236 | _advance_query(q); |
| 231 | | return q->id; |
| 237 | return id; |
| 232 | 238 | } |
| 233 | 239 | |
| 234 | 240 | uint32_t DhtRpc::query_with_commit_fn( |
| … | … | @@ -271,8 +277,11 @@ uint32_t DhtRpc::query_with_commit_fn( |
| 271 | 277 | } |
| 272 | 278 | |
| 273 | 279 | _queries[_query_count++] = q; |
| 280 | // _advance_query may COMPLETE — and delete — a query with no one to ask (an empty |
| 281 | // routing table: an announce at startup). Take the id first. |
| 282 | const uint32_t id = q->id; |
| 274 | 283 | _advance_query(q); |
| 275 | | return q->id; |
| 284 | return id; |
| 276 | 285 | } |
| 277 | 286 | |
| 278 | 287 | void DhtRpc::on_message(const uint8_t *data, size_t len, const struct sockaddr_in *from) { |