当前位置: 首页>>代码示例>>C++>>正文


C++ request_free函数代码示例

本文整理汇总了C++中request_free函数的典型用法代码示例。如果您正苦于以下问题:C++ request_free函数的具体用法?C++ request_free怎么用?C++ request_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了request_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: delete_find_items_cb

static void
delete_find_items_cb (GnomeKeyringResult result, GList *list, gpointer user_data)
{
	KeyringCall *call = user_data;
	Request *r = call->r;
	GList *iter;
	GError *error = NULL;

	r->keyring_calls = g_slist_remove (r->keyring_calls, call);
	if (r->canceled) {
		/* Callback already called by NM or dispose */
		request_free (r);
		return;
	}

	if ((result == GNOME_KEYRING_RESULT_OK) || (result == GNOME_KEYRING_RESULT_NO_MATCH)) {
		for (iter = list; iter != NULL; iter = g_list_next (iter)) {
			GnomeKeyringFound *found = (GnomeKeyringFound *) iter->data;

			gnome_keyring_item_delete (found->keyring, found->item_id, keyring_delete_cb, NULL, NULL);
		}
	} else {
		error = g_error_new (NM_SECRET_AGENT_ERROR,
		                     NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
		                     "The request could not be completed.  Keyring result: %d",
		                     result);
	}

	r->delete_callback (r->agent, r->connection, error, r->callback_data);
	request_free (r);
}
开发者ID:domsom,项目名称:nm-applet-ds,代码行数:31,代码来源:applet-agent.c

示例2: read_handler

void read_handler(aeEventLoop *el, int fd, void *privdata, int mask)
{
	int err;
	int nread;
	(void) mask;
	char buf[BUF_SIZE]={0};
	struct request *req = (struct request*)privdata;

	nread = read(fd, buf, BUF_SIZE);

	if (nread < 1) {
		request_free(req);
		aeDeleteFileEvent(el, fd, AE_WRITABLE);
		aeDeleteFileEvent(el, fd, AE_READABLE);
		close(fd);
		_clicount--;
		return;
	} else {
		request_append(req, buf, nread);
		err = request_parse(req);
		if (err == -1) {
			request_free(req);
			aeDeleteFileEvent(el, fd, AE_WRITABLE);
			aeDeleteFileEvent(el, fd, AE_READABLE);
			close(fd);
			_clicount--;
			return;
		}

		if (err == 1) {
			_process_cmd(fd, req);
			request_clean(req);
		}
	}
}
开发者ID:stnmrshx,项目名称:silokatana,代码行数:35,代码来源:siloserver.c

示例3: delete_find_items_cb

static void
delete_find_items_cb (GObject *source,
                      GAsyncResult *result,
                      gpointer user_data)
{
	Request *r = user_data;
	GError *secret_error = NULL;
	GError *error = NULL;

	r->keyring_calls--;
	if (g_cancellable_is_cancelled (r->cancellable)) {
		/* Callback already called by NM or dispose */
		request_free (r);
		return;
	}

	secret_password_clear_finish (result, &secret_error);
	if (secret_error != NULL) {
		error = g_error_new (NM_SECRET_AGENT_ERROR,
		                     NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
		                     "The request could not be completed (%s)",
		                     secret_error->message);
		g_error_free (secret_error);
	}

	r->delete_callback (r->agent, r->connection, error, r->callback_data);
	request_free (r);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-network-manager-applet,代码行数:28,代码来源:applet-agent.c

示例4: request_send

void request_send(struct fuse_conn *fc, struct fuse_in *in,
		  struct fuse_out *out)
{
	struct fuse_req *req;

	out->h.error = -ERESTARTSYS;
	if(down_interruptible(&fc->outstanding))
		return;

	out->h.error = -ENOMEM;
	req = request_new();
	if(!req)
		return;

	req->in = in;
	req->out = out;
	req->issync = 1;

	spin_lock(&fuse_lock);
	out->h.error = -ENOTCONN;
	if(fc->file) {
		in->h.unique = get_unique(fc);		
		list_add_tail(&req->list, &fc->pending);
		wake_up(&fc->waitq);
		request_wait_answer(req);
		list_del(&req->list);
	}
	spin_unlock(&fuse_lock);
	request_free(req);

	up(&fc->outstanding);
}
开发者ID:StyXman,项目名称:Trieste,代码行数:32,代码来源:dev.c

示例5: thread_handler

/**
 * here is the heart of SoftGREd/service
 */
static void *
thread_handler(void *arg)
{
    struct request *req = arg;

#if 0
    const char *host = inet_ntoa(req->saddr.sin_addr);

    D_DEBUG0("[fd=%d] handling request from %s\n", req->fd, host);

    int i = 0;
    for (i=0; i < req->argc; i++)
        D_DEBUG2("argv[%d]='%s'\n", i, req->argv[i]);
#endif

    if (!service_cmd_handler(req))
        request_appendf(req, "The command '%s' is invalid, try 'HELP'\n", req->argv[0]);

    // end request
    if (req)
        request_free(req);

    // bye
    pthread_exit(0);
    return NULL;
}
开发者ID:jinjing007,项目名称:softgre,代码行数:29,代码来源:service.c

示例6: conf_reset_thread_globals

inline NSAPIEnvironment::~NSAPIEnvironment()
{
    // Tidy up the thread-specific "globals" for the next caller
    conf_reset_thread_globals();

    // Discard the request
    if (rq)
        request_free(rq);

    // Discard the session
    if (sn) {
        if (sn->csd && sn->csd_open)
            PR_Close(sn->csd);
        sn->csd_open = 0;
        session_free(sn);
    }

    // Restore the caller's pool.  session_free() set it to NULL
    if (poolCaller)
        systhread_setdata(keyPool, poolCaller);

    // This may have been a request thread.  If it was, we need to restore the
    // HttpRequest* for the thread-specific "globals".
    if (hrq) {
        HttpRequest::SetCurrentRequest(hrq);
        conf_set_thread_globals(hrq);
    }
    else {
        conf_set_thread_globals(threadHrq, threadVS);
    }
}
开发者ID:OldsSourcesBackups,项目名称:Heliod-Web-Server,代码行数:31,代码来源:vs.cpp

示例7: destroy_request

static inline void destroy_request(struct fuse_conn *fc, struct fuse_req *req)
{
	if(req) {
		int i;

		for(i = 0; i < req->in->numargs; i++)
			kfree(req->in->args[i].value);
		kfree(req->in);
		request_free(req);
	}
}
开发者ID:StyXman,项目名称:Trieste,代码行数:11,代码来源:dev.c

示例8: save_request_try_complete

static void
save_request_try_complete (Request *r)
{
	/* Only call the SaveSecrets callback and free the request when all the
	 * secrets have been saved to the keyring.
	 */
	if (r->keyring_calls == 0) {
		if (!g_cancellable_is_cancelled (r->cancellable))
			r->save_callback (NM_SECRET_AGENT (r->agent), r->connection, NULL, r->callback_data);
		request_free (r);
	}
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-network-manager-applet,代码行数:12,代码来源:applet-agent.c

示例9: net_io_download

gboolean net_io_download(GtkWidget *parent, char *url, char **mem) {
  net_io_request_t *request = g_new0(net_io_request_t, 1);

  request->proxy = proxy_config_get();
  request->url = g_strdup(url);

  gboolean result = net_io_do(parent, request);
  if(result) 
    *mem = request->result.data.ptr;
  
  request_free(request);
  return result;
}
开发者ID:dcaliste,项目名称:maep-qt,代码行数:13,代码来源:net_io.c

示例10: request_try_free

static gboolean
request_try_free (Request *request)
{
    if (!g_cancellable_is_cancelled (request->cancellable))
        g_cancellable_cancel (request->cancellable);

    if (request->idle_funcs == 0)
        request_free (request);
    else
        g_idle_add ((GSourceFunc) request_try_free, request);

    return FALSE;
}
开发者ID:fatman2021,项目名称:gnome-apps,代码行数:13,代码来源:yelp-document.c

示例11: clear

static void clear(struct mwService *srvc) {
  struct mwServiceStorage *srvc_stor;
  GList *l;

  srvc_stor = (struct mwServiceStorage *) srvc;

  for(l = srvc_stor->pending; l; l = l->next)
    request_free(l->data);

  g_list_free(srvc_stor->pending);
  srvc_stor->pending = NULL;

  srvc_stor->id_counter = 0;
}
开发者ID:mrcsparker,项目名称:meanwhile,代码行数:14,代码来源:srvc_store.c

示例12: save_request_try_complete

static void
save_request_try_complete (Request *r, KeyringCall *call)
{
	/* Only call the SaveSecrets callback and free the request when all the
	 * secrets have been saved to the keyring.
	 */
	if (call)
		r->keyring_calls = g_slist_remove (r->keyring_calls, call);

	if (g_slist_length (r->keyring_calls) == 0) {
		if (r->canceled == FALSE)
			r->save_callback (NM_SECRET_AGENT (r->agent), r->connection, NULL, r->callback_data);
		request_free (r);
	}
}
开发者ID:domsom,项目名称:nm-applet-ds,代码行数:15,代码来源:applet-agent.c

示例13: stop

static void stop(struct mwService *srvc) {

  struct mwServiceStorage *srvc_store;
  GList *l;

  g_return_if_fail(srvc != NULL);
  srvc_store = (struct mwServiceStorage *) srvc;

  if(srvc_store->channel) {
    mwChannel_destroy(srvc_store->channel, ERR_SUCCESS, NULL);
    srvc_store->channel = NULL;
  }

#if 1
  /* the new way */
  /* remove pending requests. Sometimes we can crash the storage
     service, and when that happens, we end up resending the killer
     request over and over again, and the service never stays up */
  for(l = srvc_store->pending; l; l = l->next)
    request_free(l->data);

  g_list_free(srvc_store->pending);
  srvc_store->pending = NULL;

  srvc_store->id_counter = 0;

#else
  /* the old way */
  /* reset all of the started requests to their unstarted states */
  for(l = srvc_store->pending; l; l = l->next) {
    struct mwStorageReq *req = l->data;

    if(req->action == action_loaded) {
      req->action = action_load;
    } else if(req->action == action_saved) {
      req->action = action_save;
    }
  }
#endif

  mwService_stopped(srvc);
}
开发者ID:mrcsparker,项目名称:meanwhile,代码行数:42,代码来源:srvc_store.c

示例14: net_io_idle_cb

static gboolean net_io_idle_cb(gpointer data) {
  net_io_request_t *request = (net_io_request_t *)data;

  /* the http connection itself may have failed */
  if(request->res != 0) {
    request->result.code = 2;
    printf("Download failed with message: %s\n", request->buffer);
  } else  if(request->response != 200) {
    /* a valid http connection may have returned an error */
    request->result.code = 3;
    printf("Download failed with code %ld: %s\n", 
	   request->response, http_message(request->response));
  }

  /* call application callback */
  if(request->cb)
    request->cb(&request->result, request->data);

  request_free(request);

  return FALSE;
}
开发者ID:dcaliste,项目名称:maep-qt,代码行数:22,代码来源:net_io.c

示例15: get_secrets_cb

static void
get_secrets_cb (AppletAgent *self,
                GHashTable *secrets,
                GError *error,
                gpointer user_data)
{
	Request *r = user_data;

	/* 'secrets' shouldn't be valid if there was an error */
	if (error) {
		g_warn_if_fail (secrets == NULL);
		secrets = NULL;
	}

	if (!g_cancellable_is_cancelled (r->cancellable)) {
		/* Save updated secrets as long as user-interaction was allowed; otherwise
		 * we'd be saving secrets we just pulled out of the keyring which is somewhat
		 * redundant.
		 */
		if (secrets && (r->flags != NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)) {
			NMConnection *dupl;
			GHashTableIter iter;
			const char *setting_name;

			/* Copy the existing connection and update its secrets */
			dupl = nm_connection_duplicate (r->connection);
			g_hash_table_iter_init (&iter, secrets);
			while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, NULL))
				nm_connection_update_secrets (dupl, setting_name, secrets, NULL);

			/* And save updated secrets to the keyring */
			nm_secret_agent_save_secrets (NM_SECRET_AGENT (self), dupl, get_save_cb, NULL);
			g_object_unref (dupl);
		}

		r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, secrets, error, r->callback_data);
	}
	request_free (r);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-network-manager-applet,代码行数:39,代码来源:applet-agent.c


注:本文中的request_free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。