MCPcopy Create free account
hub / github.com/ElementsProject/lightning / rpc_open

Function rpc_open

plugins/libplugin.c:183–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183static int rpc_open(struct plugin *plugin)
184{
185 struct sockaddr_un addr;
186 int fd = socket(AF_UNIX, SOCK_STREAM, 0);
187
188 if (strlen(plugin->rpc_location) + 1 > sizeof(addr.sun_path))
189 plugin_err(plugin, "rpc filename '%s' too long",
190 plugin->rpc_location);
191 strcpy(addr.sun_path, plugin->rpc_location);
192 addr.sun_family = AF_UNIX;
193
194 if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
195 plugin_log(plugin, LOG_UNUSUAL,
196 "Could not connect to '%s': %s",
197 plugin->rpc_location, strerror(errno));
198 close(fd);
199 fd = -1;
200 }
201 return fd;
202}
203
204static void complain_deprecated(const char *feature,
205 bool allowing,

Callers 2

sync_reqFunction · 0.85
handle_initFunction · 0.85

Calls 3

plugin_errFunction · 0.70
plugin_logFunction · 0.70
connectFunction · 0.50

Tested by

no test coverage detected