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

Function rpc_open

plugins/libplugin.c:182–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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