Files
RedBear-OS/recipes/shells/zsh/source/Functions/TCP/tcp_fd_handler
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

41 lines
970 B
Plaintext

local line fd=$1 sess=${tcp_by_fd[$1]}
local TCP_HANDLER_ACTIVE=1
if [[ -n $sess ]]
then
local TCP_INVALIDATE_ZLE
if (( $# > 2 )); then
zle -I
## debugging only
# print "Flags on the play:" ${argv[3,-1]}
else
TCP_INVALIDATE_ZLE=1
fi
if ! tcp_read -d -u $fd; then
if (( ${+functions[tcp_on_awol]} )); then
tcp_on_awol $sess $fd
(( $? == 100 )) || return $?
fi
[[ -n $TCP_INVALIDATE_ZLE ]] && zle -I
print "[TCP fd $fd (session $sess) gone awol; removing from poll list]" >& 2
zle -F $fd
return 1
fi
return 0
else
zle -I
# Handle fds not in the TCP set similarly.
# This does the drain thing, to try and get as much data out as possible.
if ! read -u $fd line; then
print "[Reading on $fd failed; removing from poll list]" >& 2
zle -F $fd
return 1
fi
line="fd$fd:$line"
local newline
while read -u $fd -t newline; do
line="${line}
fd$fd:$newline"
done
fi
print -r - $line