Properly shut down tcp-listener

This commit is contained in:
Tony Garnock-Jones 2016-11-22 11:45:53 +13:00
parent 0102a7d1cd
commit c302e35024
1 changed files with 8 additions and 3 deletions

View File

@ -215,12 +215,17 @@
(loop)))
(handle-evt listener-control
(match-lambda
['quit (void)]))))))
[(list 'quit k-ch)
(tcp-close listener)
(channel-put k-ch (void))]))))))
(on-start (log-syndicate/drivers/web-info "Starting HTTP listener on port ~v" port))
(on-stop (channel-put listener-control 'quit)
(log-syndicate/drivers/web-info "Stopping HTTP listener on port ~v" port))
(on-stop (define k-ch (make-channel))
(log-syndicate/drivers/web-info "Stopping HTTP listener on port ~v" port)
(channel-put listener-control (list 'quit k-ch))
(channel-get k-ch)
(log-syndicate/drivers/web-info "Stopped HTTP listener on port ~v" port))
(on (message (inbound (web-raw-request $id port $conn $lowlevel-req $control-ch)))
(define web-req (web-request id