polserver/testsuite/pol/testpkgs/slowreader/deafctl.src
Fernando Rozenblit cd822e7cc2
Nonblocking send for aux and web (#911)
* make aux nonblocking

* fix webserver stall if client stops reading

* add StallBudget and make web sockets also non-blocking

* set small buffer size before accepting

* increase payload to force send waits
2026-07-27 19:19:51 +02:00

32 lines
1 KiB
Text

// Control channel to testsuite/deafclient/deafclient.py (not a test file itself).
//
// Started through os::OpenConnection( ..., assume_string := 1, keep_connection := 1,
// ignore_line_breaks := 0 ), so transmit() writes whole lines and each reply arrives as
// one event. Sends params.command, then forwards the helper's replies to
// params.test_script_pid as struct{ armed } and struct{ bytes }.
use os;
program auxservice( conn, params )
conn.transmit( params.command );
var ev;
while ( ( ev := wait_for_event( 120 ) ) )
if ( !ev.value )
continue;
endif
var words := SplitWords( ev.value, " " );
case ( words[1] )
"ARMED":
GetProcess( params.test_script_pid ).SendEvent( struct{ armed := 1 } );
"LISTENING":
GetProcess( params.test_script_pid ).SendEvent( struct{ listening := 1 } );
break;
"BYTES":
GetProcess( params.test_script_pid ).SendEvent( struct{ bytes := CInt( words[2] ) } );
break;
endcase
endwhile
conn := uninit;
endprogram