WIP: last_message now has some sqlite3 queries + a signal handler.
Don't assume that signalled_len or signalled have sensible values on error.