Beispiel #1
0
static void
set_current_msg (SoupConnection *conn, SoupMessage *msg)
{
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);

	g_return_if_fail (priv->state == SOUP_CONNECTION_IN_USE);

	g_object_freeze_notify (G_OBJECT (conn));

	if (priv->current_msg) {
		g_return_if_fail (priv->current_msg->method == SOUP_METHOD_CONNECT);
		clear_current_msg (conn);
	}

	stop_idle_timer (priv);

	priv->current_msg = g_object_ref (msg);
	priv->reusable = FALSE;

	g_signal_connect (msg, "got-body",
			  G_CALLBACK (current_msg_got_body), conn);

	if (priv->proxy_uri && msg->method == SOUP_METHOD_CONNECT)
		soup_connection_event (conn, G_SOCKET_CLIENT_PROXY_NEGOTIATING, NULL);

	g_object_thaw_notify (G_OBJECT (conn));
}
Beispiel #2
0
static void
soup_connection_dispose (GObject *object)
{
	SoupConnection *conn = SOUP_CONNECTION (object);
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);

	stop_idle_timer (priv);

	G_OBJECT_CLASS (soup_connection_parent_class)->dispose (object);
}
static void wake_assert() {
  if (state != LPM_DISABLED) {
    stop_idle_timer();

    uint8_t new_state = BT_VND_LPM_WAKE_ASSERT;
    vendor->send_command(VENDOR_SET_LPM_WAKE_STATE, &new_state);
    wake_state = LPM_WAKE_ASSERTED;
  }

  // TODO(zachoverflow): investigate this interaction. If someone above
  // HCI asserts wake, we'll wait until we transmit before deasserting.
  // That doesn't seem quite right.
  transmit_is_done = false;
}
Beispiel #4
0
static void
set_current_request (SoupConnectionPrivate *priv, SoupMessage *req)
{
	g_return_if_fail (priv->cur_req == NULL);

	stop_idle_timer (priv);

	soup_message_set_io_status (req, SOUP_MESSAGE_IO_STATUS_RUNNING);
	priv->cur_req = req;
	if (priv->state == SOUP_CONNECTION_IDLE ||
	    req->method != SOUP_METHOD_CONNECT)
		priv->state = SOUP_CONNECTION_IN_USE;
	g_object_add_weak_pointer (G_OBJECT (req), (gpointer)&priv->cur_req);
}
static void
dispose (GObject *object)
{
	SoupConnection *conn = SOUP_CONNECTION (object);
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);

	stop_idle_timer (priv);
	/* Make sure clear_current_request doesn't re-establish the timeout */
	priv->idle_timeout = 0;

	clear_current_request (conn);
	soup_connection_disconnect (conn);

	G_OBJECT_CLASS (soup_connection_parent_class)->dispose (object);
}
static void
set_current_request (SoupConnection *conn, SoupMessage *req)
{
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);

	g_return_if_fail (priv->cur_req == NULL);

	g_object_freeze_notify (G_OBJECT (conn));

	stop_idle_timer (priv);
	priv->unused_timeout = 0;

	soup_message_set_io_status (req, SOUP_MESSAGE_IO_STATUS_RUNNING);
	priv->cur_req = req;
	g_object_notify (G_OBJECT (conn), "message");

	if (priv->state == SOUP_CONNECTION_IDLE ||
	    req->method != SOUP_METHOD_CONNECT)
		soup_connection_set_state (conn, SOUP_CONNECTION_IN_USE);

	g_object_add_weak_pointer (G_OBJECT (req), (gpointer)&priv->cur_req);

	g_object_thaw_notify (G_OBJECT (conn));
}
static void reset_state() {
  state = LPM_DISABLED;
  wake_state = LPM_WAKE_DEASSERTED;
  transmit_is_done = true;
  stop_idle_timer();
}