@ -719,6 +719,7 @@ static struct command_result *handle_init(struct command *cmd,
char * dir , * network ;
char * dir , * network ;
struct json_out * param_obj ;
struct json_out * param_obj ;
struct plugin * p = cmd - > plugin ;
struct plugin * p = cmd - > plugin ;
bool with_rpc = true ;
configtok = json_delve ( buf , params , " .configuration " ) ;
configtok = json_delve ( buf , params , " .configuration " ) ;
@ -742,16 +743,19 @@ static struct command_result *handle_init(struct command *cmd,
addr . sun_path [ rpctok - > end - rpctok - > start ] = ' \0 ' ;
addr . sun_path [ rpctok - > end - rpctok - > start ] = ' \0 ' ;
addr . sun_family = AF_UNIX ;
addr . sun_family = AF_UNIX ;
if ( connect ( p - > rpc_conn - > fd , ( struct sockaddr * ) & addr , sizeof ( addr ) ) ! = 0 )
if ( connect ( p - > rpc_conn - > fd , ( struct sockaddr * ) & addr , sizeof ( addr ) ) ! = 0 ) {
plugin_err ( p , " Connecting to '%.*s': %s " ,
with_rpc = false ;
plugin_log ( p , LOG_UNUSUAL , " Could not connect to '%.*s': %s " ,
rpctok - > end - rpctok - > start , buf + rpctok - > start ,
rpctok - > end - rpctok - > start , buf + rpctok - > start ,
strerror ( errno ) ) ;
strerror ( errno ) ) ;
} else {
param_obj = json_out_obj ( NULL , " config " , " allow-deprecated-apis " ) ;
param_obj = json_out_obj ( NULL , " config " , " allow-deprecated-apis " ) ;
deprecated_apis = streq ( rpc_delve ( tmpctx , p , " listconfigs " ,
deprecated_apis = streq ( rpc_delve ( tmpctx , p , " listconfigs " ,
take ( param_obj ) ,
take ( param_obj ) ,
" .allow-deprecated-apis " ) ,
" .allow-deprecated-apis " ) ,
" true " ) ;
" true " ) ;
}
opttok = json_get_member ( buf , params , " options " ) ;
opttok = json_get_member ( buf , params , " options " ) ;
json_for_each_obj ( i , t , opttok ) {
json_for_each_obj ( i , t , opttok ) {
char * opt = json_strdup ( NULL , buf , t ) ;
char * opt = json_strdup ( NULL , buf , t ) ;
@ -772,6 +776,7 @@ static struct command_result *handle_init(struct command *cmd,
if ( p - > init )
if ( p - > init )
p - > init ( p , buf , configtok ) ;
p - > init ( p , buf , configtok ) ;
if ( with_rpc )
io_new_conn ( p , p - > rpc_conn - > fd , rpc_conn_init , p ) ;
io_new_conn ( p , p - > rpc_conn - > fd , rpc_conn_init , p ) ;
return command_success_str ( cmd , NULL ) ;
return command_success_str ( cmd , NULL ) ;