def wire.after.connect

emerging-ezhttp@0.21.0.0 · src/wire.bend:188

import emerging-ezhttp@0.21.0.0/src/wire.bend as Wire
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
import emerging-ezhttp@0.21.0.0/src/wirespec.bend as Spec

188# after the connect: the handshake, or the connect's failure
189def wire.after.connect(+secure: Bool, +host: String, +port: U32, +ms: U32,
190  +method: String, payload: Bytes.Bytes,
191  r: Result<&1, &1, U32 & String, Socket>) -> IO(Answer):
192  match r:
193    case Fail{(n, why)}:
194      IO.pure(Answer,
195        Failed{Spec.wire.fail(Spec.Connect{}, host, port, ms, n, why)})
196    case Done{s}:
197      IO.bind(Socket & Result<&1, &1, U32 & String, Unit>, Answer,
198        wire.shake(secure, s, host, ms),
199        r2 => wire.after.shake(secure, host, port, ms, method, payload, r2))

Uses (17)

Used by (1)