void
cb_user_stream_start (CbUserStream *self)
{
  g_debug ("%u Starting stream for %s", self->state, self->account_name);

  g_assert (self->proxy_data_set);

  if (self->proxy_call != NULL)
    rest_proxy_call_cancel (self->proxy_call);

  self->proxy_call = rest_proxy_new_call (self->proxy);

  if (self->stresstest)
    rest_proxy_call_set_function (self->proxy_call, "1.1/statuses/sample.json");
  else
    rest_proxy_call_set_function (self->proxy_call, "1.1/user.json");

  rest_proxy_call_set_method (self->proxy_call, "GET");
  start_heartbeat_timeout (self);

  rest_proxy_call_continuous (self->proxy_call,
                              continuous_cb,
                              NULL,
                              self,
                              NULL/* error */);
}
Beispiel #2
0
void
mojito_call_list_cancel_all (MojitoCallList *list)
{
  while (list->l) {
    RestProxyCall *call = list->l->data;

    rest_proxy_call_cancel (call);
    g_object_weak_unref (G_OBJECT (call), call_weak_notify, list);
    list->l = g_list_delete_link (list->l, list->l);
  }
}
void cb_user_stream_stop (CbUserStream *self)
{
  g_debug ("%u Stopping %s's stream", self->state, self->account_name);

  cb_clear_source (&self->network_timeout_id);
  cb_clear_source (&self->heartbeat_timeout_id);

  if (self->proxy_call != NULL)
    {
      self->state = STATE_STOPPING;
      rest_proxy_call_cancel (self->proxy_call);
      g_object_unref (self->proxy_call);
      self->proxy_call = NULL;
    }

  self->state = STATE_STOPPED;
}