chiark
/
gitweb
/
~ianmdlvl
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
credits: Make debian/copyright be a symlink
[secnet.git]
/
site.c
diff --git
a/site.c
b/site.c
index 358f4068e48f365196c8aef143ad0169129f3c44..89837964b757ec5b7759fbfbfeec213c4a2df0f0 100644
(file)
--- a/
site.c
+++ b/
site.c
@@
-1712,8
+1712,9
@@
static void set_link_quality(struct site *st)
static void enter_state_run(struct site *st)
{
static void enter_state_run(struct site *st)
{
- slog(st,LOG_STATE,"entering state RUN%s",
- current_valid(st) ? " (keyed)" : " (unkeyed)");
+ if (st->state!=SITE_STOP)
+ slog(st,LOG_STATE,"entering state RUN%s",
+ current_valid(st) ? " (keyed)" : " (unkeyed)");
st->state=SITE_RUN;
st->timeout=0;
st->state=SITE_RUN;
st->timeout=0;
@@
-2297,6
+2298,13
@@
static void site_phase_shutdown_hook(void *sst, uint32_t newphase)
send_msg7(st,"shutting down");
}
send_msg7(st,"shutting down");
}
+static void site_phase_run_hook(void *sst, uint32_t newphase)
+{
+ struct site *st=sst;
+ slog(st,LOG_STATE,"entering phase RUN in state %s",
+ state_name(st->state));
+}
+
static void site_childpersist_clearkeys(void *sst, uint32_t newphase)
{
struct site *st=sst;
static void site_childpersist_clearkeys(void *sst, uint32_t newphase)
{
struct site *st=sst;
@@
-2336,6
+2344,9
@@
static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
st->peerkeys_tmpl.buffer=0;
st->peerkeys_current=st->peerkeys_kex=0;
st->peerkeys_tmpl.buffer=0;
st->peerkeys_current=st->peerkeys_kex=0;
+ buffer_new(&st->scratch,SETUP_BUFFER_LEN);
+ BUF_ALLOC(&st->scratch,"site:scratch");
+
/* First parameter must be a dict */
item=list_elem(args,0);
if (!item || item->type!=t_dict)
/* First parameter must be a dict */
item=list_elem(args,0);
if (!item || item->type!=t_dict)
@@
-2400,7
+2411,7
@@
static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
cfgfatal(loc,"site","%s is not a closure\n",dictkey); \
closure_t *cl=item->data.closure; \
if (cl->type!=CL_TYPE) \
cfgfatal(loc,"site","%s is not a closure\n",dictkey); \
closure_t *cl=item->data.closure; \
if (cl->type!=CL_TYPE) \
- cfgfatal
(loc,"site","%s closure wrong type\n",dictkey);
\
+ cfgfatal
_cl_type(loc,"site",cl,CL_TYPE,dictkey);
\
st->things[i]=cl->interface; \
} \
}while(0)
st->things[i]=cl->interface; \
} \
}while(0)
@@
-2500,9
+2511,6
@@
static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
buffer_new(&st->buffer,SETUP_BUFFER_LEN);
buffer_new(&st->buffer,SETUP_BUFFER_LEN);
- buffer_new(&st->scratch,SETUP_BUFFER_LEN);
- BUF_ALLOC(&st->scratch,"site:scratch");
-
/* We are interested in poll(), but only for timeouts. We don't have
any fds of our own. */
register_for_poll(st, site_beforepoll, site_afterpoll, "site");
/* We are interested in poll(), but only for timeouts. We don't have
any fds of our own. */
register_for_poll(st, site_beforepoll, site_afterpoll, "site");
@@
-2552,6
+2560,7
@@
static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
enter_state_stop(st);
add_hook(PHASE_SHUTDOWN,site_phase_shutdown_hook,st);
enter_state_stop(st);
add_hook(PHASE_SHUTDOWN,site_phase_shutdown_hook,st);
+ add_hook(PHASE_RUN, site_phase_run_hook, st);
add_hook(PHASE_CHILDPERSIST,site_childpersist_clearkeys,st);
return new_closure(&st->cl);
add_hook(PHASE_CHILDPERSIST,site_childpersist_clearkeys,st);
return new_closure(&st->cl);