{"action":"created","issue":{"url":"https://api.github.com/repos/mcabber/loudmouth/issues/33","repository_url":"https://api.github.com/repos/mcabber/loudmouth","labels_url":"https://api.github.com/repos/mcabber/loudmouth/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/mcabber/loudmouth/issues/33/comments","events_url":"https://api.github.com/repos/mcabber/loudmouth/issues/33/events","html_url":"https://github.com/mcabber/loudmouth/pull/33","id":363838368,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4MTc0NDg3","number":33,"title":"GIOCondition is a bit field","user":{"login":"kempniu","id":1301146,"node_id":"MDQ6VXNlcjEzMDExNDY=","avatar_url":"https://avatars0.githubusercontent.com/u/1301146?v=4","gravatar_id":"","url":"https://api.github.com/users/kempniu","html_url":"https://github.com/kempniu","followers_url":"https://api.github.com/users/kempniu/followers","following_url":"https://api.github.com/users/kempniu/following{/other_user}","gists_url":"https://api.github.com/users/kempniu/gists{/gist_id}","starred_url":"https://api.github.com/users/kempniu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kempniu/subscriptions","organizations_url":"https://api.github.com/users/kempniu/orgs","repos_url":"https://api.github.com/users/kempniu/repos","events_url":"https://api.github.com/users/kempniu/events{/privacy}","received_events_url":"https://api.github.com/users/kempniu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-26T02:53:41Z","updated_at":"2018-09-26T19:44:35Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/mcabber/loudmouth/pulls/33","html_url":"https://github.com/mcabber/loudmouth/pull/33","diff_url":"https://github.com/mcabber/loudmouth/pull/33.diff","patch_url":"https://github.com/mcabber/loudmouth/pull/33.patch"},"body":"GLib documentation [states](https://developer.gnome.org/glib/2.56/glib-IO-Channels.html#GIOCondition) that `GIOCondition` is a bitwise combination of several enum values (`G_IO_IN`, `G_IO_ERR`, etc.)  Meanwhile, `GIOChannel` callbacks used by Loudmouth (`socket_connect_cb()`, `_lm_proxy_connect_cb()`) use equality tests when processing such values.  This is wrong since a test like `if (condition == G_IO_ERR)` will fail to detect an error if the `condition` value is a bitwise combination (e.g. `G_IO_OUT | G_IO_ERR`).\r\n\r\nIn the case of MCabber, this causes failed connection attempts (e.g. refused connections, timeouts) to be treated as successful connections, which is not just confusing, but breaks i.a. reconnection attempts (since `lm_connection_open()` returns `true`, but `connection_open_cb()` is never called because the connection is torn down inside Loudmouth, in `connection_socket_connect_cb()`, since it attempts to send data over a socket which has not been successfully connected).\r\n\r\nApparently things have been this way since forever as the first commit I can find that contains a faulty test like this is bb8d1709674e7be2c3e16d646d01912ffd23c430, which dates back to 2004.  As far as I can tell, GLib docs for `GIOCondition` have not changed since GLib 2.0 was released back in 2002.  Perhaps GLib's internal behavior changed somewhere along the line, but I could not cause any recent GLib version to call a `GIOChannel` callback with just `G_IO_ERR` as the second parameter.\r\n"},"comment":{"url":"https://api.github.com/repos/mcabber/loudmouth/issues/comments/424845215","html_url":"https://github.com/mcabber/loudmouth/pull/33#issuecomment-424845215","issue_url":"https://api.github.com/repos/mcabber/loudmouth/issues/33","id":424845215,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDg0NTIxNQ==","user":{"login":"McKael","id":201633,"node_id":"MDQ6VXNlcjIwMTYzMw==","avatar_url":"https://avatars0.githubusercontent.com/u/201633?v=4","gravatar_id":"","url":"https://api.github.com/users/McKael","html_url":"https://github.com/McKael","followers_url":"https://api.github.com/users/McKael/followers","following_url":"https://api.github.com/users/McKael/following{/other_user}","gists_url":"https://api.github.com/users/McKael/gists{/gist_id}","starred_url":"https://api.github.com/users/McKael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/McKael/subscriptions","organizations_url":"https://api.github.com/users/McKael/orgs","repos_url":"https://api.github.com/users/McKael/repos","events_url":"https://api.github.com/users/McKael/events{/privacy}","received_events_url":"https://api.github.com/users/McKael/received_events","type":"User","site_admin":false},"created_at":"2018-09-26T19:44:35Z","updated_at":"2018-09-26T19:44:35Z","author_association":"COLLABORATOR","body":"Thanks a lot!"}}
{"actor":{"display_login":"McKael"}}