Commit Graph

66 Commits

Author SHA1 Message Date
Rusty Russell
fe17acf07b TAGS: reformat to fix when PRINTF_FMT() used.
I was wondering why TAGS was missing some functions, and finally
tracked it down: PRINTF_FMT() confuses etags if it's at the start
of a function, and it ignores the rest of the file.

So we put PRINTF_FMT at the end, but that doesn't work for
*definitions*, only *declarations*.  So we remove it from definitions
and add gratuitous declarations in the few static places.1

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-11-01 17:27:20 -05:00
Rusty Russell
1f9de04ae4 ccan: import updated version to get uintmap_before().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-10 21:48:52 -05:00
Rusty Russell
25ddb80823 ccan: update to fix shutdown slowness after plugin load.
Dynamic plugins were keeping fds open; they should not have these
at all anyway, but worse, they interfere with operation because
we don't notice they're closed.

The symptom was that shutdown of the test_plugin_slowinit and
test_plugin_command was 30 seconds (10 seconds grace to kill each daemon).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-15 02:22:01 +00:00
Rusty Russell
979fbeb3b0 lightningd: simplify --daemon.
Dumb programs which have a --daemon option call fork() early.  This is
terrible UX since startup errors get lost: the program exits with
"success" immediately then you discover via the logs that it didn't
start at all.

However, forking late introduced a heap of problems with changing
pids.  Instead, fork early but keep stderr and the parent around: if
we fail early on, the parent fails with us.  We release our parent
with an explicit action just before the main loop.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-04 21:29:03 +02:00
Rusty Russell
79345cc0b9 CCAN: update to suppress path_readlink warning.
Reported-by: Chirimen-Jako
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-02 15:56:15 +02:00
Rusty Russell
641876a20a ccan: update to latest.
configurator failed under clang:

checking for #pragma omp and -fopenmp support... ccan/tools/configurator/configurator: Test for HAVE_OPENMP failed with 32512:
./configurator.out: error while loading shared libraries: libomp.so: cannot open shared object file: No such file or directory

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-02 15:56:15 +02:00
Rusty Russell
220449e1cd ccan: import ccan/json_out and ccan/json_escape.
These are generalized from our internal implementations.

The main difference is that 'struct json_escaped' is now 'struct
json_escape', so we replace that immediately.

The difference between lightningd's json-writing ringbuffer and the
more generic ccan/json_out is that the latter has a better API and
handles escaping transparently if something slips through (though
it does offer direct accessors so you can mess things up yourself!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-12 02:00:15 +00:00
Rusty Russell
0d2a4830ed ccan: update to faster and correct crc32c implementation.
I decided to try a faster implementation, only to find our crc32c was
not correct!  Ouch.

I removed the crc32c functions from ccan/crc, and added a new crc32c
module which has the Mark Adler x86-64-optimized variants.

We bump gossip_store version again, since csums have changed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-11 23:40:10 +00:00
Rusty Russell
3c13369431 ccan: update to get smaller htable implementation.
MCP results from 5 runs, min-max(mean +/- stddev):
	store_rewrite_sec:46.750000-48.280000(47.512+/-0.51)
	listnodes_sec:1.100000-1.400000(1.192+/-0.11)
	listchannels_sec:49.530000-56.410000(53.914+/-2.3)
	routing_sec:29.500000-32.970000(30.392+/-1.3)
	peer_write_all_sec:50.760000-52.140000(51.348+/-0.59)

MCP notable changes from previous patch (>1 stddev):
-	vsz_kb:2639240
+	vsz_kb:2638880
2019-04-09 12:37:16 -07:00
Rusty Russell
a319439957 ccan: update to get ccan/io exclusive helpers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 01:56:17 +00:00
Rusty Russell
0361f43ec3 ccan: update
Brings in fixes for closing stderr in parent for pipecmd (oops!)
and configurator fix (which we don't need yet)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-07 13:05:59 +01:00
Rusty Russell
8e7c8a18df ccan: update to latest version, which includes more take() checks.
And add the missing unit test from my previous update.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-12-18 12:17:27 +01:00
Rusty Russell
6da213be31 ccan: update to get updated pipecmd.
Note that this changes the order of arguments to pipecmd to match the
documentation, so we fix all the callers!

Also make configure re-run when configurator changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-12-10 00:00:50 +00:00
Rusty Russell
fac68630b8 ccan: add ccan/bitmap.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-21 00:36:31 +00:00
Christian Decker
045f7ce7f7 ccan: Update ccan modules to include incomplete option parsing
Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Rusty Russell
cd8446f081 ccan: update to get new ccan/io which sets errno to 0 on EOF.
We get structeq and htable updates we don't need for free.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-19 00:53:00 +00:00
Rusty Russell
acc01e6436 ccan: update.
This was from a different series, so I just cherry-picked it.

It adds ccan/membuf as a depenency of ccan/rbuf, though we don't use
it directly yet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-19 00:53:00 +00:00
Rusty Russell
c02ab124aa ccan: update so we can apply notifiers to toplevel "NULL".
This will make leak detection more thorough.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-08-24 19:54:32 +02:00
Rusty Russell
5179025977 ccan: upgrade to new ccan/tal and ccan/tal/str.
The visible changes are:
1. tal_len() is renamed to tal_bytelen() for clarity.
2. tal allocations *always* know their length.
3. tal/str routines always set the length to strlen() + 1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-07-30 11:31:17 +02:00
Rusty Russell
fed5a117e7 Update ccan/structeq.
structeq() is too dangerous: if a structure has padding, it can fail
silently.

The new ccan/structeq instead provides a macro to define foo_eq(),
which does the right thing in case of padding (which none of our
structures currently have anyway).

Upgrade ccan, and use it everywhere.  Except run-peer-wire.c, which
is only testing code and can use raw memcmp(): valgrind will tell us
if padding exists.

Interestingly, we still declared short_channel_id_eq, even though
we didn't define it any more!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-07-04 23:57:00 +02:00
Rusty Russell
2639b1e9a9 ccan: add UTF-8 module for checking alias fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-07-01 14:55:29 +02:00
Rusty Russell
d395b58ffa ccan: update to have new configurator.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-08 17:56:01 +02:00
Christian Decker
9acb92103c ccan: Add CRC library for gossip_store
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-05-29 12:16:00 +00:00
nicolas.dorier
59154ebd34 Fix build on linux-musl
[ Done by updating CCAN with the ccan/endian fix --RR ]
2018-05-15 05:54:15 +00:00
Rusty Russell
53c6ceeab9 ccan: import base32 module.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-10 02:28:44 +00:00
Rusty Russell
57115f4914 ccan: update and import rbuf module.
This is a simple helper for dealing with buffered I/O.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-10 02:28:44 +00:00
Rusty Russell
9c3691340f ccan: update to more recent version.
In particular, this gets some MacOS fixes from #1327.
It also includes a major intmap update which fixes corner cases in traversals,
and requires ccan/bitops.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-04-06 13:34:27 +02:00
Rusty Russell
629c3db421 ccan: update to get tal_free fix.
This allows us to make heirarchy loops, such as reference counting to
free our own parent.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-03 19:29:35 +01:00
Rusty Russell
8c2a556f55 ccan: update so we get configurator with --configurator-cc= arg.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-26 15:01:02 +01:00
Rusty Russell
237a65d000 ccan: add tal/link.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-19 02:56:51 +00:00
Rusty Russell
c5cc5c5c1b ccan: import ccan/daemonize.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-16 13:02:41 +01:00
Rusty Russell
ccd0e5db54 ccan: update so we get exposed path constants.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-16 13:02:41 +01:00
Rusty Russell
736a80db08 ccan: update so ccan/io doesn't exit when we get signals.
In particular, we're going to capture SIGUSR1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-07 00:46:49 +00:00
Rusty Russell
ed2158c334 Revert "Functions for encoding reversed hex"
This reverts commit ef5678956d2eedf9904ce32f12f6367bc26c59e7.
2017-12-21 11:05:38 +00:00
Andrew Chow
19116b6561 Functions for encoding reversed hex 2017-12-21 11:05:38 +00:00
Rusty Russell
a8f033f6ae ccan: update to get new ccan/io changes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-25 18:34:35 +02:00
Rusty Russell
2374b54ef2 ccan: update to get io fix for duplex pipes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-20 18:31:32 +02:00
Rusty Russell
c92dd56dd5 ccan: update for better tal debugging checks.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-04 20:46:26 +02:00
Rusty Russell
1ffb9f07c1 ccan: update to latest shachain.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-20 13:06:41 +09:30
Rusty Russell
35ec22b946 ccan: update to expose io_fd_block() from ccan/io.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-07-12 10:21:16 +09:30
Rusty Russell
7f0d54533a ccan: update to fix io_wake bug.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-06-07 09:19:04 +09:30
Rusty Russell
83466b2b32 ccan: update to get close option to io/fdpass.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-20 07:50:53 +10:30
Christian Decker
05cf3160d4 ccan: Added ccan/intmap 2017-02-02 11:29:47 +10:30
Rusty Russell
ad82d29379 ccan: update to get tal_len(NULL)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-25 11:03:55 +10:30
Rusty Russell
91209d4d66 ccan: forgotten test files after last update.
Also add ccan/config.h to .gitignore.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-11 10:17:33 +10:30
Rusty Russell
1ba7f59d31 ccan: updates to get constant STR_MAX_CHARS and io_close_taken_fd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:19:33 +10:30
Rusty Russell
f8344baf64 ccan: update, new modules.
ccan/autodata, ccan/breakpoint, ccan/crypto/hmac_sha256, ccan/crypto/hkdf_sha256,
ccan/fdpass and ccan/io/fdpass.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 13:16:47 +10:30
Rusty Russell
74d471d4e4 ccan: update.
This gives us a slew of -Wextra fixes (not all of them though!) but
we're actually doing it for the monotonic version of timers.

This breaks some stuff, so we fix that up next.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-09 18:55:15 +10:30
Rusty Russell
922fba9fbe ccan: remove canned config.h
It's probably wrong for you.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 13:59:57 +10:30
Rusty Russell
678df3525e ccan: update, add cppmagic.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 13:47:07 +09:30