nandi/frqpublic Fork 0
77c1a08
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Take connect through io-call with the other three

connect is the fourth :capture-native-error binding in jolt.socket and was
the one left behind: accept, recv and send were unwrapped, and the pair
connect answers went on reaching neg? in frq.irc/open. It is only on the
plain-socket path, which the TLS default never takes, so it only broke the
:6667 fallback — and broke it as "Could not connect: class
clojure.lang.PersistentVector cannot be cast to class java.lang.Number",
which is what the fallback is for.

Through jolt's io-call like its neighbours, waiting on writability: a
socket that finishes connecting reports itself writable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-10T09:50:54-07:00 Browse files
77c1a08 parent: 7f86322
modified src/frq/irc.clj +1 -1
@@ -241,7 +241,7 @@
241241 (let [ip (#'socket/ip->str (socket/resolve-host host))
242242 fd (socket/c-socket af-inet sock-stream 0)]
243243 (when (neg? fd) (throw (ex-info "socket() failed" {:host host})))
244- (let [rc (socket/c-connect fd (#'socket/make-sockaddr-in ip (int port)) 16)]
244+ (let [rc (wire/connect! fd (#'socket/make-sockaddr-in ip (int port)) 16)]
245245 (when (neg? rc)
246246 (socket/c-close fd)
247247 (throw (ex-info "connect() failed" {:host host :ip ip :port port}))))
@@ -241,7 +241,7 @@
241 (let [ip (#'socket/ip->str (socket/resolve-host host))241 (let [ip (#'socket/ip->str (socket/resolve-host host))
242 fd (socket/c-socket af-inet sock-stream 0)]242 fd (socket/c-socket af-inet sock-stream 0)]
243 (when (neg? fd) (throw (ex-info "socket() failed" {:host host})))243 (when (neg? fd) (throw (ex-info "socket() failed" {:host host})))
244- (let [rc (socket/c-connect fd (#'socket/make-sockaddr-in ip (int port)) 16)]244+ (let [rc (wire/connect! fd (#'socket/make-sockaddr-in ip (int port)) 16)]
245 (when (neg? rc)245 (when (neg? rc)
246 (socket/c-close fd)246 (socket/c-close fd)
247 (throw (ex-info "connect() failed" {:host host :ip ip :port port}))))247 (throw (ex-info "connect() failed" {:host host :ip ip :port port}))))
modified src/frq/wire.clj +11 -0
@@ -38,6 +38,17 @@
3838 [fd buf len]
3939 (io-call #(socket/c-recv fd buf len 0) fd :read))
4040
41+(defn connect!
42+ "One `connect` to the address at `sa`, answering zero or a negative.
43+
44+ `connect` is the fourth of these bindings and was left out of the round
45+ that fixed the other three: it is only on the plain-socket path, which the
46+ TLS default does not take, so its pair reached `neg?` unnoticed. The wait
47+ is for writability — a socket that finishes connecting reports itself
48+ writable, which is what jolt's poller is being asked about here."
49+ [fd sa len]
50+ (io-call #(socket/c-connect fd sa len) fd :write))
51+
4152 (defn accept!
4253 "One `accept` on a listening fd, answering the connected fd or a negative."
4354 [fd]
@@ -38,6 +38,17 @@
38 [fd buf len]38 [fd buf len]
39 (io-call #(socket/c-recv fd buf len 0) fd :read))39 (io-call #(socket/c-recv fd buf len 0) fd :read))
40 40
41+(defn connect!
42+ "One `connect` to the address at `sa`, answering zero or a negative.
43+
44+ `connect` is the fourth of these bindings and was left out of the round
45+ that fixed the other three: it is only on the plain-socket path, which the
46+ TLS default does not take, so its pair reached `neg?` unnoticed. The wait
47+ is for writability — a socket that finishes connecting reports itself
48+ writable, which is what jolt's poller is being asked about here."
49+ [fd sa len]
50+ (io-call #(socket/c-connect fd sa len) fd :write))
51+
41 (defn accept!52 (defn accept!
42 "One `accept` on a listening fd, answering the connected fd or a negative."53 "One `accept` on a listening fd, answering the connected fd or a negative."
43 [fd]54 [fd]