ssh kitten: Send data without a roundtrip
Send data to the remote side without waiting for a data request. Avoids an extra roundtrip during initialization.
This commit is contained in:
@@ -27,6 +27,7 @@ with SharedMemory(
|
||||
shm.flush()
|
||||
with open(os.ctermid(), 'wb') as f:
|
||||
f.write(f'\x1bP@kitty-ask|{shm.name}\x1b\\'.encode('ascii'))
|
||||
f.flush()
|
||||
while True:
|
||||
# TODO: Replace sleep() with a mutex and condition variable created in the shared memory
|
||||
time.sleep(0.05)
|
||||
|
||||
@@ -73,8 +73,7 @@ login_cwd=""
|
||||
|
||||
request_data="REQUEST_DATA"
|
||||
trap "cleanup_on_bootstrap_exit" EXIT
|
||||
dcs_to_kitty "ssh" "id="REQUEST_ID":pwfile="PASSWORD_FILENAME":pw="DATA_PASSWORD""
|
||||
record_separator=$(printf "\036")
|
||||
[ "$request_data" = "1" ] && dcs_to_kitty "ssh" "id="REQUEST_ID":pwfile="PASSWORD_FILENAME":pw="DATA_PASSWORD""
|
||||
|
||||
mv_files_and_dirs() {
|
||||
cwd="$PWD"
|
||||
@@ -135,16 +134,6 @@ untar_and_read_env() {
|
||||
tdir=""
|
||||
}
|
||||
|
||||
read_record() {
|
||||
record=""
|
||||
while :; do
|
||||
read_one_byte_from_tty || die "Reading a byte from the TTY failed"
|
||||
[ "$n" = "$record_separator" ] && break
|
||||
record="$record$n"
|
||||
done
|
||||
printf "%s" "$record"
|
||||
}
|
||||
|
||||
get_data() {
|
||||
started="n"
|
||||
while IFS= read -r line; do
|
||||
|
||||
Reference in New Issue
Block a user