Modernize the keepalive process
This commit is contained in:
parent
d980e4920f
commit
71efc80fe8
47
rowbot
47
rowbot
|
@ -536,7 +536,7 @@ net_recv() {
|
|||
declare -n sock_line=$1
|
||||
# The only possible fail conditions are already checked for.
|
||||
# shellcheck disable=SC2155
|
||||
local in_sock=$(NS=net state_get "$in_sock")
|
||||
local in_sock=$(NS=net state_get in-sock)
|
||||
IFS= read -ru "$in_sock" "$1"
|
||||
sock_line=${sock_line%$'\r'}
|
||||
log_trace "received line: %s" "$sock_line"
|
||||
|
@ -545,7 +545,7 @@ net_recv() {
|
|||
net_send() {
|
||||
# The only possible fail conditions are already checked for.
|
||||
# shellcheck disable=SC2155
|
||||
local fmt out_sock=$(NS=net state_get "$out_sock")
|
||||
local fmt out_sock=$(NS=net state_get out-sock)
|
||||
# As this is a printf wrapper, the format string is provided as an argument.
|
||||
# shellcheck disable=SC2059
|
||||
printf -v fmt "$1" "${@:2}"
|
||||
|
@ -644,18 +644,8 @@ annoyatron900() {
|
|||
run_callbacks annoyatron900_
|
||||
}
|
||||
|
||||
on_sys_before_999_annoyatron900() {
|
||||
if [[ -v alarm_pid ]]; then
|
||||
export ALARM_PID=$alarm_pid
|
||||
fi
|
||||
}
|
||||
|
||||
on_sys_after_999_annoyatron900() {
|
||||
on_sys_init_900_annoyatron900() {
|
||||
trap annoyatron900 USR1
|
||||
|
||||
if [[ -v ALARM_PID ]]; then
|
||||
alarm_pid=$ALARM_PID
|
||||
fi
|
||||
}
|
||||
|
||||
on_sys_register_999_annoyatron900() {
|
||||
|
@ -664,16 +654,23 @@ on_sys_register_999_annoyatron900() {
|
|||
kill -USR1 "$$"
|
||||
done &
|
||||
|
||||
alarm_pid=$!
|
||||
trap annoyatron900 USR1
|
||||
local alarm_pid=$!
|
||||
NS=annoyatron900 state_put alarm-pid "$alarm_pid"
|
||||
log_debug "process %d is being annoying" "$alarm_pid"
|
||||
}
|
||||
|
||||
on_sys_exit_997_annoyatron900() {
|
||||
log_debug "shutting down annoyatron900"
|
||||
|
||||
if [[ -v alarm_pid ]] && is_running "$alarm_pid"; then
|
||||
kill -STOP "$alarm_pid"
|
||||
|
||||
if NS=annoyatron900 state_has alarm-pid; then
|
||||
# The only possible fail conditions are already checked for.
|
||||
# shellcheck disable=SC2155
|
||||
local alarm_pid=$(NS=annoyatron900 state_get alarm-pid)
|
||||
|
||||
if is_running "$alarm_pid"; then
|
||||
kill -STOP "$alarm_pid"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -682,16 +679,16 @@ on_sys_exit_997_annoyatron900() {
|
|||
###
|
||||
|
||||
on_sys_first_003_welcome() {
|
||||
get_option nick rowbot-dev
|
||||
get_option ident rowbot
|
||||
get_option realname rowbot
|
||||
#get_option nick rowbot-dev
|
||||
#get_option ident rowbot
|
||||
#get_option realname rowbot
|
||||
log_debug "registering with the server"
|
||||
irc_nick "${config[nick]}"
|
||||
irc_user "${config[ident]}" "${config[realname]}"
|
||||
}
|
||||
|
||||
on_sys_init_999_welcome() {
|
||||
get_option chan ""
|
||||
# get_option chan ""
|
||||
declare -gA isupport
|
||||
}
|
||||
|
||||
|
@ -1170,7 +1167,8 @@ on_init_sysfacts() {
|
|||
# alternick tracking
|
||||
|
||||
on_init_alternick() {
|
||||
get_option registered no
|
||||
# get_option registered no
|
||||
:
|
||||
}
|
||||
|
||||
on_register_alternick() {
|
||||
|
@ -1275,7 +1273,7 @@ plugin_not_found_factoids() {
|
|||
}
|
||||
|
||||
on_init_factoids() {
|
||||
get_option fact-root ""
|
||||
# get_option fact-root ""
|
||||
|
||||
if [[ ${config[fact-root]} && -d ${config[fact-root]} ]]; then
|
||||
plugin_reg is factoids_cmd_is
|
||||
|
@ -1287,7 +1285,8 @@ on_init_factoids() {
|
|||
# request default modes
|
||||
|
||||
on_init_mode_getter() {
|
||||
get_option modes wigR
|
||||
# get_option modes wigR
|
||||
:
|
||||
}
|
||||
|
||||
on_register_mode_getter() {
|
||||
|
|
Loading…
Reference in New Issue