Add stop-server word
parent
c6be6bcfdf
commit
80c9fe3c83
|
@ -26,8 +26,10 @@ LOG: accepted-connection NOTICE
|
||||||
: server-loop ( server quot -- )
|
: server-loop ( server quot -- )
|
||||||
[ accept-loop ] curry with-disposal ; inline
|
[ accept-loop ] curry with-disposal ; inline
|
||||||
|
|
||||||
|
SYMBOL: servers
|
||||||
|
|
||||||
: spawn-server ( addrspec quot -- )
|
: spawn-server ( addrspec quot -- )
|
||||||
>r <server> r> server-loop ; inline
|
>r <server> dup servers get push r> server-loop ; inline
|
||||||
|
|
||||||
\ spawn-server NOTICE add-error-logging
|
\ spawn-server NOTICE add-error-logging
|
||||||
|
|
||||||
|
@ -39,9 +41,13 @@ LOG: accepted-connection NOTICE
|
||||||
|
|
||||||
: with-server ( seq service quot -- )
|
: with-server ( seq service quot -- )
|
||||||
[
|
[
|
||||||
|
V{ } clone servers set
|
||||||
[ spawn-server ] curry concurrency:parallel-each
|
[ spawn-server ] curry concurrency:parallel-each
|
||||||
] curry with-logging ; inline
|
] curry with-logging ; inline
|
||||||
|
|
||||||
|
: stop-server ( -- )
|
||||||
|
servers get [ dispose ] each ;
|
||||||
|
|
||||||
: received-datagram ( addrspec -- ) drop ;
|
: received-datagram ( addrspec -- ) drop ;
|
||||||
|
|
||||||
\ received-datagram NOTICE add-input-logging
|
\ received-datagram NOTICE add-input-logging
|
||||||
|
|
Loading…
Reference in New Issue