After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771217 - Fix another connection issue
Fix another connection issue
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Polari maintainers
Polari maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-10 23:38 UTC by Florian Müllner
Modified: 2016-09-23 23:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
connections: Always set port when SSL is enabled (1.21 KB, patch)
2016-09-10 23:38 UTC, Florian Müllner
committed Details | Review
connections: Factor out getAccountParams() method (1.99 KB, patch)
2016-09-10 23:38 UTC, Florian Müllner
committed Details | Review
application: Consider port for alternate server list (1.99 KB, patch)
2016-09-10 23:38 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2016-09-10 23:38:37 UTC
So it turns out I lost another connection parameter again, this time for Freenode. I figured out the issue however, see the first patch.
What made the issue more pressing was that it didn't fix itself by retrying with alternate servers from the list, as all entries only differ by port and we end up filtering them all out. The last patch addresses this issue as well.
Comment 1 Florian Müllner 2016-09-10 23:38:42 UTC
Created attachment 335279 [details] [review]
connections: Always set port when SSL is enabled

At least for now telepathy-idle does not consider the 'use-ssl'
parameter for picking a default port, so include it even when
not explicitly specified to make sure it is not accidentally
removed.
Comment 2 Florian Müllner 2016-09-10 23:38:48 UTC
Created attachment 335280 [details] [review]
connections: Factor out getAccountParams() method

There are cases where we don't just want to retrieve and unpack
account parameters, but also make sure that appropriate fallbacks
for missing values are in place; split out an appropriate help
function for that.
Comment 3 Florian Müllner 2016-09-10 23:38:55 UTC
Created attachment 335281 [details] [review]
application: Consider port for alternate server list

When we fail to connect to a network with multiple servers, we build
a list of alternate servers for retrying, excluding the original
server that already failed. Currently that filtering is based solely
on the server address, in the assumption that servers would not just
differ by port - however that's exactly the case for FreeNode, so
to not effectively disable connection retries there, we need to take
the port number into account as well.
Comment 4 Rares Visalom 2016-09-23 10:51:49 UTC
Review of attachment 335280 [details] [review]:

+        params[p] = params[p].deep_unpack();
+
+    params['use-ssl'] = !!params['use-ssl'];

Is there a typo here? I was unable to find the '!!' operator.
Comment 5 Florian Müllner 2016-09-23 11:18:23 UTC
(In reply to Rares Visalom from comment #4)
> +    params['use-ssl'] = !!params['use-ssl'];
> 
> Is there a typo here? I was unable to find the '!!' operator.

No, it's a C-ism that is occasionally useful. '!!' is not an operator on its own, it's the '!' operator applied twice. The result is a proper boolean, even when the original value was only falsey or trueish (for example null, 1, undefined, '', ...). In this case, it's to handle the case where 'use-ssl' isn't defined, and could alternatively be written like:
  params['use-ssl'] = params['use-ssl'] || false;
Comment 6 Rares Visalom 2016-09-23 11:51:55 UTC
Review of attachment 335279 [details] [review]:

looks good to me.
Comment 7 Rares Visalom 2016-09-23 11:52:19 UTC
Review of attachment 335280 [details] [review]:

looks good to me.
Comment 8 Rares Visalom 2016-09-23 11:53:06 UTC
Review of attachment 335280 [details] [review]:

(forgot to change status)
Comment 9 Rares Visalom 2016-09-23 11:55:33 UTC
Review of attachment 335281 [details] [review]:

looks good to me.
Comment 10 Florian Müllner 2016-09-23 23:44:00 UTC
Attachment 335279 [details] pushed as fbb168b - connections: Always set port when SSL is enabled
Attachment 335280 [details] pushed as 1a23da2 - connections: Factor out getAccountParams() method
Attachment 335281 [details] pushed as a2331c7 - application: Consider port for alternate server list