chiark / gitweb /
site: Document some reentrancy hazards in comments
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 17 May 2014 15:31:21 +0000 (16:31 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 May 2014 13:53:12 +0000 (14:53 +0100)
No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
New patch in v2 of the series.

site.c

diff --git a/site.c b/site.c
index fe0e1a7..1169052 100644 (file)
--- a/site.c
+++ b/site.c
@@ -1174,6 +1174,7 @@ static void site_resolve_callback(void *sst, struct in_addr *address)
 static bool_t initiate_key_setup(struct site *st, cstring_t reason,
                                 const struct comm_addr *prod_hint)
 {
 static bool_t initiate_key_setup(struct site *st, cstring_t reason,
                                 const struct comm_addr *prod_hint)
 {
+    /* Reentrancy hazard: can call enter_new_state/enter_state_* */
     if (st->state!=SITE_RUN) return False;
     slog(st,LOG_SETUP_INIT,"initiating key exchange (%s)",reason);
     if (st->address) {
     if (st->state!=SITE_RUN) return False;
     slog(st,LOG_SETUP_INIT,"initiating key exchange (%s)",reason);
     if (st->address) {
@@ -1286,6 +1287,7 @@ static void enter_state_run(struct site *st)
 
 static bool_t enter_state_resolve(struct site *st)
 {
 
 static bool_t enter_state_resolve(struct site *st)
 {
+    /* Reentrancy hazard!  See ensure_resolving. */
     state_assert(st,st->state==SITE_RUN);
     slog(st,LOG_STATE,"entering state RESOLVE");
     st->state=SITE_RESOLVE;
     state_assert(st,st->state==SITE_RUN);
     slog(st,LOG_STATE,"entering state RESOLVE");
     st->state=SITE_RESOLVE;