Codebase list telepathy-idle / 8e4889f
Connection: use a boolean for ServerConnection status Will Thompson 11 years ago
1 changed file(s) with 10 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
145145 * network connection
146146 */
147147 IdleServerConnection *conn;
148 guint sconn_status;
148 /*
149 * TRUE if 'conn' is connected to the server. (This just represents the TCP
150 * stream; not whether we are authenticated.)
151 */
152 gboolean sconn_connected;
149153
150154 /* When we sent a PING to the server which it hasn't PONGed for yet, or 0 if
151155 * there isn't a PING outstanding.
245249 IdleConnectionPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, IDLE_TYPE_CONNECTION, IdleConnectionPrivate);
246250
247251 obj->priv = priv;
248 priv->sconn_status = SERVER_CONNECTION_STATE_NOT_CONNECTED;
252 priv->sconn_connected = FALSE;
249253 priv->msg_queue = g_queue_new();
250254
251255 tp_contacts_mixin_init ((GObject *) obj, G_STRUCT_OFFSET (IdleConnection, contacts));
710714 }
711715
712716 priv->conn = sconn;
713 priv->sconn_status = SERVER_CONNECTION_STATE_CONNECTED;
717 priv->sconn_connected = TRUE;
714718
715719 g_signal_connect(sconn, "received", (GCallback)(sconn_received_cb), conn);
716720
789793 tp_reason = TP_CONNECTION_STATUS_REASON_REQUESTED;
790794
791795 connection_disconnect_cb(conn, tp_reason);
792 priv->sconn_status = SERVER_CONNECTION_STATE_NOT_CONNECTED;
796 priv->sconn_connected = FALSE;
793797 }
794798
795799 static void sconn_received_cb(IdleServerConnection *sconn, gchar *raw_msg, IdleConnection *conn) {
805809 gchar cmd[IRC_MSG_MAXLEN + 1];
806810 gint64 now;
807811
808 if (priv->sconn_status != SERVER_CONNECTION_STATE_CONNECTED ||
812 if (!priv->sconn_connected ||
809813 priv->quitting) {
810814 priv->keepalive_timeout = 0;
811815 return FALSE;
865869
866870 IDLE_DEBUG("called");
867871
868 if (priv->sconn_status != SERVER_CONNECTION_STATE_CONNECTED) {
872 if (!priv->sconn_connected) {
869873 IDLE_DEBUG("connection was not connected!");
870874
871875 priv->msg_queue_timeout = 0;