def bounded.send.ready

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

import bend-kit-http@0.38.5.0/http.bend as Http
import Base
import bend-kit-wire@0.4.8.0/wire.bend as Wire
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

5555def bounded.send.ready(expired: Bool, s: Socket, b: Bytes.Bytes, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, Unit>):
5556  match expired:
5557    case True{}:
5558      IO.pure(Socket & Result<&1, &1, U32 & String, Unit>, (s, Fail{(60, "write deadline expired")}))
5559    case False{}:
5560      Bytes.Bytes{len, words} = b
5561      do IO<Socket & Result<&1, &1, U32 & String, Unit>>:
5562        sent : Socket & (U32 & Result<&1, &1, U32 & String, Unit>) <- Wire.send.words.deadline(s, len, words, ms)
5563        return bounded.sent(sent)

Uses (14)

Used by (1)