diff --git a/examples/ircd/TODO.md b/examples/ircd/TODO.md index 4dff327..dca024b 100644 --- a/examples/ircd/TODO.md +++ b/examples/ircd/TODO.md @@ -4,5 +4,9 @@ If two connections, A and B, exist, and - A renames itself to A' then B receives two ":A NICK A'" messages. This shouldn't happen. -When X quits (disconnects), peers in channels X was in get a PART. -They should get a QUIT. +A similar problem occurs for ":B QUIT" messages when A is in two +channels that B is also in, and B disconnects. + +When A is a member of #room1, which has B and C in it, and A +disconnects, the session code futilely sends ":B PART #room1" and ":C +PART #room1", even though the connection is now gone. diff --git a/examples/ircd/session.rkt b/examples/ircd/session.rkt index 62104f1..80b14d4 100644 --- a/examples/ircd/session.rkt +++ b/examples/ircd/session.rkt @@ -51,23 +51,17 @@ (irc-source-nick N U)) (on-stop (when (current-other-source) (send* #:source (current-other-source) "PART" Ch))) (begin/dataflow - (when (and (next-other-source) - ;; ^ Becomes #f when other-conn disconnects, - ;; apparently by retraction of ircd-connection-info - ;; but before the retraction of ircd-channel-member - ;; is processed for some reason. TODO investigate - ;; this more closely. Should event-handlers that - ;; stop a facet prevent execution of contained - ;; event-handlers in the same turn? - (not (equal? (current-other-source) (next-other-source)))) - (if (initial-names-sent?) - (if (current-other-source) - (when (not (equal? this-conn other-conn)) ;; avoid dups for our own connection - (send* #:source (current-other-source) "NICK" - (irc-source-nick-nick (next-other-source)))) - (send* #:source (next-other-source) "JOIN" Ch)) - (initial-member-nicks (set-add (initial-member-nicks) - (irc-source-nick-nick (next-other-source))))) + (when (not (equal? (current-other-source) (next-other-source))) + (if (next-other-source) ;; not disconnecting, IOW + (if (initial-names-sent?) + (if (current-other-source) + (when (not (equal? this-conn other-conn)) ;; avoid dups for our own connection + (send* #:source (current-other-source) "NICK" + (irc-source-nick-nick (next-other-source)))) + (send* #:source (next-other-source) "JOIN" Ch)) + (initial-member-nicks (set-add (initial-member-nicks) + (irc-source-nick-nick (next-other-source))))) + (send* #:source (current-other-source) "QUIT")) (current-other-source (next-other-source))))) (on (asserted (ircd-channel-topic Ch $topic)) (if topic