mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-27 03:42:49 +00:00
simplify logic
This commit is contained in:
parent
512d6bd308
commit
64870af53f
1 changed files with 3 additions and 8 deletions
|
|
@ -107,12 +107,7 @@ func run_stdin_echo_loop(conn *net.Conn, io_data *rc_io_data) (err error) {
|
|||
}
|
||||
|
||||
func simple_socket_io(conn *net.Conn, io_data *rc_io_data) (serialized_response []byte, err error) {
|
||||
const (
|
||||
BEFORE_FIRST_ESCAPE_CODE_SENT = iota
|
||||
SENDING
|
||||
)
|
||||
state := BEFORE_FIRST_ESCAPE_CODE_SENT
|
||||
|
||||
first_escape_code_sent := false
|
||||
wants_streaming := io_data.rc.Stream
|
||||
for {
|
||||
var chunk []byte
|
||||
|
|
@ -131,7 +126,8 @@ func simple_socket_io(conn *net.Conn, io_data *rc_io_data) (serialized_response
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
if state == BEFORE_FIRST_ESCAPE_CODE_SENT {
|
||||
if !first_escape_code_sent {
|
||||
first_escape_code_sent = true
|
||||
if wants_streaming {
|
||||
var streaming_response []byte
|
||||
streaming_response, err = read_response_from_conn(conn, io_data.timeout)
|
||||
|
|
@ -143,7 +139,6 @@ func simple_socket_io(conn *net.Conn, io_data *rc_io_data) (serialized_response
|
|||
return
|
||||
}
|
||||
}
|
||||
state = SENDING
|
||||
}
|
||||
}
|
||||
if io_data.rc.NoResponse {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue