Fixed server log statements

This commit is contained in:
Thiago de Arruda 2013-10-29 19:01:31 -03:00
parent 09954ddd71
commit 3dbe2c8c9b

View file

@ -14,13 +14,13 @@ read-to-null() {
accept-connection() { accept-connection() {
zsocket -a $server zsocket -a $server
fds[$REPLY]=1 fds[$REPLY]=1
print "connection accepted, fd: $REPLY" >&2 print "connection accepted, fd: $REPLY"
} }
handle-request() { handle-request() {
local connection=$1 current line local connection=$1 current line
integer read_something=0 integer read_something=0
print "request received from fd $connection" >&2 print "request received from fd $connection"
while read -u $connection prefix &> /dev/null; do while read -u $connection prefix &> /dev/null; do
read_something=1 read_something=1
# send the prefix to be completed followed by a TAB to force # send the prefix to be completed followed by a TAB to force
@ -44,7 +44,7 @@ handle-request() {
break # handle more requests/return to zselect break # handle more requests/return to zselect
done done
if ! (( read_something )); then if ! (( read_something )); then
print "connection with fd $connection closed" >&2 print "connection with fd $connection closed"
unset fds[$connection] unset fds[$connection]
exec {connection}>&- # free the file descriptor exec {connection}>&- # free the file descriptor
fi fi
@ -68,7 +68,6 @@ exec < /dev/null
zmodload zsh/zpty zmodload zsh/zpty
zmodload zsh/zselect zmodload zsh/zselect
zmodload zsh/net/socket zmodload zsh/net/socket
zmodload zsh/net/socket
setopt noglob setopt noglob
print "autosuggestion server started, pid: $$" print "autosuggestion server started, pid: $$"