• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ request_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: request_free

/*
 *	Free a REQUEST struct.
 */
void request_free(REQUEST **request_ptr)
{
	REQUEST *request;

	if (!request_ptr || !*request_ptr) {
		return;
	}

	request = *request_ptr;

	rad_assert(!request->in_request_hash);
#ifdef WITH_PROXY
	rad_assert(!request->in_proxy_hash);
#endif
	rad_assert(!request->ev);

#ifdef WITH_COA
	if (request->coa) {
		request->coa->parent = NULL;
		request_free(&request->coa);
	}

	if (request->parent && (request->parent->coa == request)) {
		request->parent->coa = NULL;
	}
#endif

#ifndef NDEBUG
	request->magic = 0x01020304;	/* set the request to be nonsense */
#endif
	request->client = NULL;
#ifdef WITH_PROXY
	request->home_server = NULL;
#endif
	talloc_free(request);
	*request_ptr = NULL;

	VERIFY_ALL_TALLOC;
}
开发者ID:aparadis,项目名称:freeradius-server,代码行数:42,代码来源:util.c


示例17: request_alloc_fake

REQUEST *request_alloc_coa(REQUEST *request)
{
	if (!request || request->coa) return NULL;

	/*
	 *	Originate CoA requests only when necessary.
	 */
	if ((request->packet->code != PW_AUTHENTICATION_REQUEST) &&
	    (request->packet->code != PW_ACCOUNTING_REQUEST)) return NULL;

	request->coa = request_alloc_fake(request);
	if (!request->coa) return NULL;

	request->coa->packet->code = 0; /* unknown, as of yet */
	request->coa->child_state = REQUEST_RUNNING;
	request->coa->proxy = rad_alloc(request->coa, 0);
	if (!request->coa->proxy) {
		request_free(&request->coa);
		return NULL;
	}

	return request->coa;
}
开发者ID:ilovlif,项目名称:freeradius-server,代码行数:23,代码来源:util.c


示例18: request_send_noreply

/* This one is currently only used for sending FORGET and RELEASE,
   which are kernel initiated request.  So the outstanding semaphore
   is not used.  */
int request_send_noreply(struct fuse_conn *fc, struct fuse_in *in)
{
	struct fuse_req *req;

	req = request_new();
	if(!req)
		return -ENOMEM;

	req->in = in;
	req->issync = 0;

	spin_lock(&fuse_lock);
	if(!fc->file) {
		spin_unlock(&fuse_lock);
		request_free(req);
		return -ENOTCONN;
	}

	list_add_tail(&req->list, &fc->pending);
	wake_up(&fc->waitq);
	spin_unlock(&fuse_lock);
	return 0;
}
开发者ID:StyXman,项目名称:Trieste,代码行数:26,代码来源:dev.c


示例19: tls_socket_recv

static int tls_socket_recv(rad_listen_t *listener)
{
	int doing_init = FALSE;
	ssize_t rcode;
	RADIUS_PACKET *packet;
	REQUEST *request;
	listen_socket_t *sock = listener->data;
	fr_tls_status_t status;
	RADCLIENT *client = sock->client;

	if (!sock->packet) {
		sock->packet = rad_alloc(0);
		if (!sock->packet) return 0;

		sock->packet->sockfd = listener->fd;
		sock->packet->src_ipaddr = sock->other_ipaddr;
		sock->packet->src_port = sock->other_port;
		sock->packet->dst_ipaddr = sock->my_ipaddr;
		sock->packet->dst_port = sock->my_port;

		if (sock->request) sock->request->packet = sock->packet;
	}

	/*
	 *	Allocate a REQUEST for debugging.
	 */
	if (!sock->request) {
		sock->request = request = request_alloc();
		if (!sock->request) {
			radlog(L_ERR, "Out of memory");
			return 0;
		}

		rad_assert(request->packet == NULL);
		rad_assert(sock->packet != NULL);
		request->packet = sock->packet;

		request->component = "<core>";
		request->component = "<tls-connect>";

		/*
		 *	Not sure if we should do this on every packet...
		 */
		request->reply = rad_alloc(0);
		if (!request->reply) return 0;

		request->options = RAD_REQUEST_OPTION_DEBUG2;

		rad_assert(sock->ssn == NULL);

		sock->ssn = tls_new_session(listener->tls, sock->request,
					    listener->tls->require_client_cert);
		if (!sock->ssn) {
			request_free(&sock->request);
			sock->packet = NULL;
			return 0;
		}

		SSL_set_ex_data(sock->ssn->ssl, FR_TLS_EX_INDEX_REQUEST, (void *)request);
		SSL_set_ex_data(sock->ssn->ssl, FR_TLS_EX_INDEX_CERTS, (void *)&request->packet->vps);

		doing_init = TRUE;
	}

	rad_assert(sock->request != NULL);
	rad_assert(sock->request->packet != NULL);
	rad_assert(sock->packet != NULL);
	rad_assert(sock->ssn != NULL);

	request = sock->request;

	RDEBUG3("Reading from socket %d", request->packet->sockfd);
	PTHREAD_MUTEX_LOCK(&sock->mutex);
	rcode = read(request->packet->sockfd,
		     sock->ssn->dirty_in.data,
		     sizeof(sock->ssn->dirty_in.data));
	if ((rcode < 0) && (errno == ECONNRESET)) {
	do_close:
		PTHREAD_MUTEX_UNLOCK(&sock->mutex);
		tls_socket_close(listener);
		return 0;
	}
	
	if (rcode < 0) {
		RDEBUG("Error reading TLS socket: %s", strerror(errno));
		goto do_close;
	}

	/*
	 *	Normal socket close.
	 */
	if (rcode == 0) goto do_close;
	
	sock->ssn->dirty_in.used = rcode;
	memset(sock->ssn->dirty_in.data + sock->ssn->dirty_in.used,
	       0, 16);

	dump_hex("READ FROM SSL", sock->ssn->dirty_in.data, sock->ssn->dirty_in.used);

	/*
//.........这里部分代码省略.........
开发者ID:SudoSource,项目名称:freeradius-server,代码行数:101,代码来源:tls_listen.c


示例20: fetch_uri

/*
 * Fetches the resource denoted by |uri|.
 */
static void fetch_uri(const struct URI *uri)
{
  spdylay_session_callbacks callbacks;
  int fd;
  SSL_CTX *ssl_ctx;
  SSL *ssl;
  struct Request req;
  struct Connection connection;
  int rv;
  nfds_t npollfds = 1;
  struct pollfd pollfds[1];
  uint16_t spdy_proto_version;

  request_init(&req, uri);

  setup_spdylay_callbacks(&callbacks);

  /* Establish connection and setup SSL */
  fd = connect_to(req.host, req.port);
  ssl_ctx = SSL_CTX_new(SSLv23_client_method());
  if(ssl_ctx == NULL) {
    dief("SSL_CTX_new", ERR_error_string(ERR_get_error(), NULL));
  }
  init_ssl_ctx(ssl_ctx, &spdy_proto_version);
  ssl = SSL_new(ssl_ctx);
  if(ssl == NULL) {
    dief("SSL_new", ERR_error_string(ERR_get_error(), NULL));
  }
  /* To simplify the program, we perform SSL/TLS handshake in blocking
     I/O. */
  ssl_handshake(ssl, fd);

  connection.ssl = ssl;
  connection.want_io = IO_NONE;

  /* Here make file descriptor non-block */
  make_non_block(fd);
  set_tcp_nodelay(fd);

  printf("[INFO] SPDY protocol version = %d\n", spdy_proto_version);
  rv = spdylay_session_client_new(&connection.session, spdy_proto_version,
                                  &callbacks, &connection);
  if(rv != 0) {
    diec("spdylay_session_client_new", rv);
  }

  /* Submit the HTTP request to the outbound queue. */
  submit_request(&connection, &req);

  pollfds[0].fd = fd;
  ctl_poll(pollfds, &connection);

  /* Event loop */
  while(spdylay_session_want_read(connection.session) ||
        spdylay_session_want_write(connection.session)) {
    int nfds = poll(pollfds, npollfds, -1);
    if(nfds == -1) {
      dief("poll", strerror(errno));
    }
    if(pollfds[0].revents & (POLLIN | POLLOUT)) {
      exec_io(&connection);
    }
    if((pollfds[0].revents & POLLHUP) || (pollfds[0].revents & POLLERR)) {
      die("Connection error");
    }
    ctl_poll(pollfds, &connection);
  }

  /* Resource cleanup */
  spdylay_session_del(connection.session);
  SSL_shutdown(ssl);
  SSL_free(ssl);
  SSL_CTX_free(ssl_ctx);
  shutdown(fd, SHUT_WR);
  close(fd);
  request_free(&req);
}
开发者ID:Chris112,项目名称:sep,代码行数:80,代码来源:test_request_response.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ request_init函数代码示例发布时间:2022-05-30
下一篇:
C++ request_firmware_nowait函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap