~/bend-docscommunity

sock.bend relies on unsafe/foreign

raw source on the hub · import element-http@0.1.0.0/sock.bend as Sock

1 import
import Base

Definitions

def recv_fold source · line 19 · raw

@p:Pair(Socket, Result<&1, &1, Pair(U32, String), Maybe<&1, List<&2, U32>>>) -> Pair(Socket, Result<&1, &1, Pair(U32, String), List<&2, U32>>)

Base 2.0.36 (PR #1259) says the end of the peer's data as None (a read of Some{[]} never comes) and hands a failed send back what the kernel did not take. Element's readers test an empty read for the end (fetch's read_loop, main.bend's got_data, the TLS record reader) and never resend, so both are folded here to the 2.0.35 shapes every caller keeps.

def send_fold source · line 33 · raw

@p:Pair(Socket, Result<&1, &1, Pair(Pair(U32, String), List<&2, U32>), Unit>) -> Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>)

def Net.recv_bytes source · line 45 · raw

@sock:Socket -> @max:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), List<&2, U32>>))

def Net.send_bytes source · line 51 · raw

@sock:Socket -> @data:List<&2, U32> -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

def Net.send source · line 60 · raw

@sock:Socket -> @data:String -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

A text send, the same way (the HTTP request line and headers). Bend 2.0.38+ hands the unsent bytes back as a List<&2, U32> (a write cut inside a UTF-8 character loses nothing); it was a String.

Effects (foreign code)

effect Net.resolve source · line 10 · raw

@host:String -> IO(Result<&1, &1, Pair(U32, String), String>)

foreign: effs/net_resolve.c, effs/net_resolve.js