Skip to content

Commit dd9cae8

Browse files
REMOVE: testing CI
1 parent 2a3bdf2 commit dd9cae8

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

plugins/recklessrpc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static struct io_plan *read_more(struct io_conn *conn, struct reckless *rkls)
6969
static struct command_result *reckless_result(struct io_conn *conn,
7070
struct reckless *reckless)
7171
{
72+
io_close(conn);
7273
struct json_stream *response;
7374
if (reckless->process_failed) {
7475
response = jsonrpc_stream_fail(reckless->cmd,
@@ -154,6 +155,14 @@ static void reckless_conn_finish(struct io_conn *conn,
154155
plugin_log(plugin, LOG_DBG, "err: %s", strerror(errno));
155156
struct pollfd pfd = { .fd = reckless->logfd, .events = POLLIN };
156157
poll(&pfd, 1, 20); // wait for any remaining log data
158+
159+
/* Close the log streaming socket. */
160+
if (reckless->logfd) {
161+
if (close(reckless->logfd) != 0)
162+
plugin_log(plugin, LOG_DBG, "closing log socket failed: %s", strerror(errno));
163+
reckless->logfd = 0;
164+
}
165+
157166
if (reckless->pid > 0) {
158167
int status = 0;
159168
pid_t p;
@@ -162,6 +171,7 @@ static void reckless_conn_finish(struct io_conn *conn,
162171
if (p != reckless->pid && reckless->pid) {
163172
plugin_log(plugin, LOG_DBG, "reckless failed to exit, "
164173
"killing now.");
174+
io_close(conn);
165175
kill(reckless->pid, SIGKILL);
166176
reckless_fail(reckless, "reckless process hung");
167177
/* Reckless process exited and with normal status? */
@@ -253,7 +263,7 @@ static void log_notify(char * log_line TAKES)
253263
static void log_conn_finish(struct io_conn *conn, struct reckless *reckless)
254264
{
255265
io_close(conn);
256-
close(reckless->logfd);
266+
reckless->logfd = 0;
257267

258268
}
259269

tests/test_reckless.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,11 @@ def test_reckless_notifications(node_factory):
468468
as 'reckless_log' notifications"""
469469
notification_plugin = os.path.join(os.getcwd(), 'tests/plugins/custom_notifications.py')
470470
node = get_reckless_node(node_factory, options={"plugin": notification_plugin})
471+
NETWORK = os.environ.get('TEST_NETWORK')
472+
if not NETWORK:
473+
NETWORK = 'regtest'
474+
reckless(['listconfig', f'--network={NETWORK}', '--json'],
475+
dir=node.lightning_dir)
471476
node.start()
472477
listconfig_log = node.rpc.reckless('listconfig')['log']
473478
# Some trouble escaping the clone url for searching

tools/reckless

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,8 +2556,6 @@ if __name__ == '__main__':
25562556

25572557
if log.capture:
25582558
log.reply_json()
2559-
# Allow log streaming socket to close before process exits
2560-
time.sleep(0.20)
2559+
# We're done streaming to this socket, but the rpc plugin will close it.
25612560
if log.socket:
2562-
log.socket.close()
2563-
time.sleep(0.001)
2561+
log.socket.shutdown(socket.SHUT_WR)

0 commit comments

Comments
 (0)