def server.close

bend-kit-http@0.38.5.0 · http.bend:6375

import bend-kit-http@0.38.5.0/http.bend as Http
import Base
import bend-kit-http@0.38.5.0/admission.bend as Admission

6375# Only the listener owner closes it, after the current accept really returns.
6376# Joining the controller waits for every real operation, including callbacks.
6377def server.close(~C: Data, server: Server<C>) -> IO(ServerCounts):
6378  Server{listener, context, config, +inbox, drained} = server
6379  do IO<ServerCounts>:
6380    requested : Bool <- Admission.quiesce(inbox)
6381    Listener.close(listener)
6382    Admission.close(inbox)
6383    counts : Admission.Counts <- IO.join(Admission.Counts, drained)
6384    return server.final.counts(counts)

Uses (13)

Used by (2)