コード例 #1
0
/**
 * @brief Free an #Azy_Client
 *
 * This function frees a client and ALL associated data.  If called
 * on a connected client, azy_client_close will be called and then the client
 * will be freed.
 * @param client The client (NOT NULL)
 */
void
azy_client_free(Azy_Client *client)
{
   DBG("(client=%p)", client);

   if (!AZY_MAGIC_CHECK(client, AZY_MAGIC_CLIENT))
     {
        AZY_MAGIC_FAIL(client, AZY_MAGIC_CLIENT);
        return;
     }

   if (client->connected)
     azy_client_close(client);
   AZY_MAGIC_SET(client, AZY_MAGIC_NONE);
   if (client->addr)
     eina_stringshare_del(client->addr);
   if (client->session_id)
     eina_stringshare_del(client->session_id);
   if (client->add)
     ecore_event_handler_del(client->add);
   if (client->del)
     ecore_event_handler_del(client->del);
   if (client->upgrade)
     ecore_event_handler_del(client->upgrade);
   if (client->callbacks)
     eina_hash_free(client->callbacks);
   if (client->free_callbacks)
     eina_hash_free(client->free_callbacks);
   if (client->conns)
     client->conns = eina_list_free(client->conns);
   free(client);
}
コード例 #2
0
ファイル: http-simple.c プロジェクト: gfriloux/maelstrom
static Eina_Error
ret_cb(Azy_Client *cli, Azy_Content *content, Eina_Binbuf *data)
{
   Eina_Strbuf *buf;

   if (azy_content_error_is_set(content))
     printf("Error encountered: %s\n", azy_content_error_message_get(content));
   else
     {
        const Eina_List *cookies;

        printf("Success!\n");
        buf = eina_strbuf_new();
        cookies = azy_net_cookie_set_list_get(azy_content_net_get(content));
        if (cookies)
          azy_net_cookie_set_list_generate(buf, cookies);
        cookies = azy_net_cookie_send_list_get(azy_content_net_get(content));
        if (cookies)
          azy_net_cookie_send_list_generate(buf, cookies);
        printf("%s\n", eina_strbuf_string_get(buf));
        eina_strbuf_free(buf);
     }
   if (!azy_client_current(cli)) azy_client_close(cli);
   return AZY_ERROR_NONE;
}