@@ -71,8 +71,8 @@ struct plugin {
7171 struct plugin_option * opts ;
7272
7373 /* Anything special to do at init ? */
74- void (* init )(struct plugin * p ,
75- const char * buf , const jsmntok_t * );
74+ const char * (* init )(struct plugin * p ,
75+ const char * buf , const jsmntok_t * );
7676 /* Has the manifest been sent already ? */
7777 bool manifested ;
7878 /* Has init been received ? */
@@ -878,8 +878,12 @@ static struct command_result *handle_init(struct command *cmd,
878878 tal_free (opt );
879879 }
880880
881- if (p -> init )
882- p -> init (p , buf , configtok );
881+ if (p -> init ) {
882+ const char * disable = p -> init (p , buf , configtok );
883+ if (disable )
884+ return command_success (cmd , json_out_obj (cmd , "disable" ,
885+ disable ));
886+ }
883887
884888 if (with_rpc )
885889 io_new_conn (p , p -> rpc_conn -> fd , rpc_conn_init , p );
@@ -1296,8 +1300,9 @@ static struct io_plan *stdout_conn_init(struct io_conn *conn,
12961300}
12971301
12981302static struct plugin * new_plugin (const tal_t * ctx ,
1299- void (* init )(struct plugin * p ,
1300- const char * buf , const jsmntok_t * ),
1303+ const char * (* init )(struct plugin * p ,
1304+ const char * buf ,
1305+ const jsmntok_t * ),
13011306 const enum plugin_restartability restartability ,
13021307 bool init_rpc ,
13031308 struct feature_set * features ,
@@ -1365,8 +1370,8 @@ static struct plugin *new_plugin(const tal_t *ctx,
13651370}
13661371
13671372void plugin_main (char * argv [],
1368- void (* init )(struct plugin * p ,
1369- const char * buf , const jsmntok_t * ),
1373+ const char * (* init )(struct plugin * p ,
1374+ const char * buf , const jsmntok_t * ),
13701375 const enum plugin_restartability restartability ,
13711376 bool init_rpc ,
13721377 struct feature_set * features ,
0 commit comments