From e2c2953fc537afa2b6eb36af6c571c88b3fdaa30 Mon Sep 17 00:00:00 2001 From: "." <.@.> Date: Sun, 8 May 2016 12:24:30 +1200 Subject: [PATCH] passthrough upstream disconnections instead of intermediary-reconnecting --HG-- branch : nmdc-ircfrontend --- COMPATIBILITY.txt | 29 +++++++++++++++++++++++++++++ TODO.txt | 44 +++----------------------------------------- server.go | 9 +++++++-- 3 files changed, 39 insertions(+), 43 deletions(-) create mode 100644 COMPATIBILITY.txt diff --git a/COMPATIBILITY.txt b/COMPATIBILITY.txt new file mode 100644 index 0000000..aeef6b3 --- /dev/null +++ b/COMPATIBILITY.txt @@ -0,0 +1,29 @@ + +Everything works: + Hexchat + Mango IRC (ads) + AndroIRC (ads) + Mutter + Weechat + +Usable, with bugs: + AndChat + - duplicate usernames appearing. possibly an upstream bug https://github.com/znc/znc/issues/424 + Irssi + - critical nicklist_set_host: assertion 'host != NULL' failed + - still occurs even without blank nicks in room privmsgs + +Unusable: + Lite IRC (ads) + - sends USER /then/ NICK instead of the other way around, handshake fails + 2016/05/07 22:57:04 <<< :nmdc-ircfrontend 375 :- Message of the day - + 2016/05/07 22:57:04 <<< :nmdc-ircfrontend 372 :- Connected to nmdc-ircfrontend. You /must/ join #chat to continue. + 2016/05/07 22:57:04 <<< :nmdc-ircfrontend 376 :- End of MOTD + 2016/05/07 22:57:04 >>> 'USER' [pineapple420 0 * :first last] + 2016/05/07 22:57:04 <<< :Your nickname is already being used KILL A + 2016/05/07 22:57:04 >>> 'NICK' [pineapple420] + 2016/05/07 22:57:04 Broken loop. + Yaaic/Atomic + - doesn't properly understand/parse the room join + Atomic + - crashes if a blank nick is used for room privmsgs (but PtokaX is fine) \ No newline at end of file diff --git a/TODO.txt b/TODO.txt index ed2a396..adb098e 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,46 +1,7 @@ - -COMPATIBILITY -============= - -Everything works: - Hexchat - Mango IRC (ads) - AndroIRC (ads) - Mutter - Weechat - -Usable, with bugs: - AndChat - - duplicate usernames appearing. possibly an upstream bug https://github.com/znc/znc/issues/424 - Irssi - - critical nicklist_set_host: assertion 'host != NULL' failed - - still occurs even without blank nicks in room privmsgs - -Unusable: - Lite IRC (ads) - - sends USER /then/ NICK instead of the other way around, handshake fails - 2016/05/07 22:57:04 <<< :nmdc-ircfrontend 375 :- Message of the day - - 2016/05/07 22:57:04 <<< :nmdc-ircfrontend 372 :- Connected to nmdc-ircfrontend. You /must/ join #chat to continue. - 2016/05/07 22:57:04 <<< :nmdc-ircfrontend 376 :- End of MOTD - 2016/05/07 22:57:04 >>> 'USER' [pineapple420 0 * :first last] - 2016/05/07 22:57:04 <<< :Your nickname is already being used KILL A - 2016/05/07 22:57:04 >>> 'NICK' [pineapple420] - 2016/05/07 22:57:04 Broken loop. - Yaaic/Atomic - - doesn't properly understand/parse the room join - Atomic - - crashes if a blank nick is used for room privmsgs (but PtokaX is fine) - - - PRE-RELEASE =========== -- part all nicks upon upstream server disconnection - -- test the current password auth - - detect our own /me messages + don't echo back - threadsafe access to libnmdc hub options @@ -49,6 +10,9 @@ PRE-RELEASE - expose upstream op status +- remove color code escape sequences + +---- libnmdc no alert on bad nick WISHLIST @@ -72,8 +36,6 @@ WISHLIST - support SASL PLAIN authentication as well as just classic PASS -- remove color code escape sequences - - KILL messages not being exposed in client(?) 2016/05/07 22:51:33 <<< :Your nickname is already being used KILL A diff --git a/server.go b/server.go index 58f0728..b57595d 100644 --- a/server.go +++ b/server.go @@ -62,8 +62,9 @@ func NewServer(name string, upstream libnmdc.HubAddress, conn net.Conn) *Server clientState: CSUnregistered, motd: "Connected to " + name + ". You /must/ join " + BLESSED_CHANNEL + " to continue.", upstreamLauncher: libnmdc.HubConnectionOptions{ - Address: upstream, - Self: *self, + Address: upstream, + Self: *self, + SkipAutoReconnect: true, }, upstreamCloser: make(chan struct{}, 1), } @@ -170,6 +171,10 @@ func (s *Server) upstreamWorker() { if hubEvent.StateChange == libnmdc.CONNECTIONSTATE_CONNECTED { s.sendNames() // delay doing this until now } + if hubEvent.StateChange == libnmdc.CONNECTIONSTATE_DISCONNECTED { + // Abandon thread. Don't try to autoreconnect at our level, the remote client can be responsible for that + s.DisconnectClient() + } case libnmdc.EVENT_HUBNAME_CHANGED: s.sendChannelTopic(hubEvent.Nick)