Compare commits
2 Commits
mempool
...
junderw/lo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12538c2ec1 | ||
|
|
4e24d48b34 |
@ -70,7 +70,7 @@ tempfile = "3.0"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
panic = 'abort'
|
||||
panic = 'unwind'
|
||||
codegen-units = 1
|
||||
|
||||
[patch.crates-io.electrum-client]
|
||||
|
||||
@ -7,6 +7,7 @@ use std::net::IpAddr;
|
||||
use std::net::{Shutdown, SocketAddr, TcpListener, TcpStream};
|
||||
use std::os::unix::fs::FileTypeExt;
|
||||
use std::os::unix::net::{UnixListener, UnixStream};
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
@ -903,7 +904,28 @@ impl RPC {
|
||||
discovery,
|
||||
);
|
||||
senders.lock().unwrap().push(conn.chan.sender());
|
||||
conn.run();
|
||||
// unwind any panics inside the connection for logging
|
||||
//
|
||||
// Safety: we use AssertUnwindSafe because we don't have any
|
||||
// interior mutability that could be left in an invalid state
|
||||
// after a panic. We just log and exit the thread.
|
||||
let result = catch_unwind(AssertUnwindSafe(|| {
|
||||
conn.run();
|
||||
}));
|
||||
// panic occurred
|
||||
if let Err(err) = result {
|
||||
let msg = if let Some(s) = err.downcast_ref::<&str>() {
|
||||
*s
|
||||
} else if let Some(s) = err.downcast_ref::<String>() {
|
||||
s.as_str()
|
||||
} else {
|
||||
"(unknown panic payload)"
|
||||
};
|
||||
error!("[{}] connection panicked: {}", addr, msg);
|
||||
// Forward the panic for now just to keep the behavior similar to before
|
||||
// (Although panics were silently ignored before, so it's not the same)
|
||||
std::panic::panic_any(err);
|
||||
}
|
||||
info!("[{}] disconnected peer", addr);
|
||||
let _ = killer_clone.send(());
|
||||
let _ = garbage_sender.send(std::thread::current().id());
|
||||
|
||||
13
start
13
start
@ -9,6 +9,17 @@ NODENAME=$(hostname|cut -d . -f1)
|
||||
LOCATION=$(hostname|cut -d . -f2)
|
||||
USAGE="Usage: $0 (mainnet|testnet|signet|liquid|liquidtestnet) [popular-scripts]"
|
||||
|
||||
# set default log verbosity if unset
|
||||
if [ -z "${ELECTRS_LOG_VERBOSITY+x}" ];then
|
||||
ELECTRS_LOG_VERBOSITY="-vv"
|
||||
# validate log verbosity if set
|
||||
# Can be -v, -vv, -vvv, -vvvv or "" (set to empty string)
|
||||
elif [[ -n "${ELECTRS_LOG_VERBOSITY}" && ! "${ELECTRS_LOG_VERBOSITY}" =~ ^-v{1,4}$ ]];then
|
||||
echo "[!] ELECTRS_LOG_VERBOSITY variable is set to invalid value '${ELECTRS_LOG_VERBOSITY}'." >&2
|
||||
echo "[!] It must be one of: -v, -vv, -vvv, -vvvv or \"\". If unset it will default to -vv." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# load rust if necessary
|
||||
if [ -e "${HOME}/.cargo/env" ];then
|
||||
source "${HOME}/.cargo/env"
|
||||
@ -229,6 +240,6 @@ do
|
||||
--address-search \
|
||||
--utxos-limit "${UTXOS_LIMIT}" \
|
||||
--electrum-txs-limit "${ELECTRUM_TXS_LIMIT}" \
|
||||
-vv
|
||||
"${ELECTRS_LOG_VERBOSITY}"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user