本文整理汇总了C++中session_free函数的典型用法代码示例。如果您正苦于以下问题:C++ session_free函数的具体用法?C++ session_free怎么用?C++ session_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了session_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: session_delete
void session_delete(t_session *session)
{
t_context *context;
t_session *tmp;
t_session *tmp2;
session_end(session);
context = get_context_ptr((void *)0);
VERBOSE(printf("\033[%d;1m<%03d> - session delete\033[m\n",
COLOR(session->id), session->id));
tmp = context->sessions;
if (tmp == session)
{
context->sessions = tmp->next;
session_free(tmp);
return ;
}
tmp2 = tmp;
tmp = tmp->next;
for (tmp2 = tmp, tmp = tmp->next; tmp && tmp != session;
tmp = tmp->next, tmp2 = tmp2->next)
;
if (tmp == session)
{
tmp2->next = tmp->next;
session_free(tmp);
}
return ;
}
示例2: fe_close_window
void
fe_close_window (struct session *sess)
{
/*
* There's really no point in doing all of this if the user is
* quitting the app. It makes it slow (as they watch individual
* channels and servers disappear), and the OS is about to free
* everything much more efficiently than we ever could.
*
* If we ever choose to run on Windows ME, this could be a problem :)
*/
if (gui.quit) {
session_free (sess);
return;
}
navigation_tree_remove_session (gui.server_tree, sess);
conversation_panel_remove_session (CONVERSATION_PANEL (gui.conversation_panel), sess);
topic_label_remove_session (TOPIC_LABEL (gui.topic_label), sess);
text_entry_remove_session (TEXT_ENTRY (gui.text_entry), sess);
if (sess->type == SESS_SERVER) {
status_bar_remove_server (STATUS_BAR (gui.status_bar), sess->server);
}
if (sess == gui.current_session) {
gui.current_session = NULL;
}
session_free (sess);
}
示例3: session_eventcb
/*
* Handle socket events, such as connection failure or success.
* - BEV_EVENT_ERROR - network is unreachable
* - BEV_EVENT_ERROR+READING - connection refused or connection timed out
* - BEV_EVENT_TIMEOUT+READING - write timeout, if activated by
* bufferevent_set_timeouts
*/
static void
session_eventcb(struct bufferevent *bev, short what, void *thunk)
{
struct session *session = thunk;
switch (what & ~(BEV_EVENT_READING|BEV_EVENT_WRITING)) {
case BEV_EVENT_CONNECTED:
session_send(session);
return;
case BEV_EVENT_EOF:
bufferevent_disable(bev, EV_READ|EV_WRITE);
if (session->completed)
target_mark(session->t, session->seq, '.');
else
target_mark(session->t, session->seq, '%');
break;
case BEV_EVENT_ERROR:
bufferevent_disable(bev, EV_READ|EV_WRITE);
target_mark(session->t, session->seq, '#');
break;
case BEV_EVENT_TIMEOUT:
target_mark(session->t, session->seq, '?');
break;
}
session_free(session);
}
示例4: sink_input_kill
/* Called from main context */
static void sink_input_kill(pa_sink_input* i) {
struct session *s;
pa_sink_input_assert_ref(i);
pa_assert_se(s = i->userdata);
session_free(s);
}
示例5: 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);
}
}
示例6: signal_handler
PRIVATE void signal_handler(int sig) {
switch (sig) {
case SIGINT:
case SIGTERM: {
dbg_printf(P_INFO2, "SIGTERM/SIGINT caught");
closing = true;
break;
}
case SIGHUP: {
if(isRunning || !mySession) {
seenHUP = true;
} else {
auto_handle * s = NULL;
dbg_printf(P_MSG, "Caught SIGHUP. Reloading config file.");
s = session_init();
if((parse_config_file(s, AutoConfigFile) != 0) || !setupSession(s)) {
dbg_printf(P_ERROR, "Error parsing config file. Keeping the old settings.");
session_free(s);
}
seenHUP = false;
}
break;
}
}
}
示例7: ssh_relay_event_cb
static void
ssh_relay_event_cb(struct bufferevent *bev, short what, void *ptr)
{
obfsproxyssh_client_session_t *session = ptr;
struct evbuffer *buf;
assert(bev == session->ssh_ev);
if (what & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) {
session->ssh_is_valid = 0;
libssh2_channel_free(session->ssh_channel);
session->ssh_channel = NULL;
libssh2_session_free(session->ssh_session);
session->ssh_session = NULL;
buf = bufferevent_get_output(session->socks_ev);
if (0 == session->socks_is_valid || 0 ==
evbuffer_get_length(buf))
session_free(session);
else {
bufferevent_disable(session->socks_ev, EV_READ);
bufferevent_setcb(session->socks_ev, NULL,
socks_relay_teardown_cb,
socks_event_cb, session);
}
}
}
示例8: on_disconnect
static void on_disconnect(netc_t *netc)
{
struct session *session;
session = netc->ext_ptr;
session_free(session);
}
示例9: client_free
/**
@brief Free a transport_client, along with all resources it owns.
@param client Pointer to the transport_client to be freed.
@return 1 if successful, or 0 if not. The only error condition is if @a client is NULL.
*/
int client_free( transport_client* client ) {
if(client == NULL)
return 0;
session_free( client->session );
client->session = NULL;
return client_discard( client );
}
示例10: obc_session_unref
void obc_session_unref(struct obc_session *session)
{
int refs;
refs = __sync_sub_and_fetch(&session->refcount, 1);
DBG("%p: ref=%d", session, refs);
if (refs > 0)
return;
sessions = g_slist_remove(sessions, session);
if (!session->obex)
goto disconnect;
/* Wait OBEX Disconnect to complete if command succeed otherwise
* proceed with transport disconnection since there is nothing else to
* be done */
if (g_obex_disconnect(session->obex, disconnect_complete, session,
NULL))
return;
disconnect:
/* Disconnect transport */
if (session->id > 0 && session->transport != NULL) {
session->transport->disconnect(session->id);
session->id = 0;
}
session_free(session);
}
示例11: session_mem_create
int session_mem_create(session_opt_t *so, request_t *rq, response_t *rs,
session_t **pss)
{
session_t *ss = NULL;
dbg_err_if (so == NULL);
dbg_err_if (rq == NULL);
dbg_err_if (rs == NULL);
dbg_err_if (pss == NULL);
ss = u_zalloc(sizeof(session_t));
dbg_err_if(ss == NULL);
ss->load = session_mem_load;
ss->save = session_mem_save;
ss->remove = session_mem_remove;
ss->term = session_mem_term;
ss->mtime = time(0);
ss->so = so;
dbg_err_if(session_prv_init(ss, rq, rs));
*pss = ss;
return 0;
err:
if(ss)
session_free(ss);
return ~0;
}
示例12: ssh_auth_cb
static void
ssh_auth_cb(obfsproxyssh_client_session_t *session)
{
obfsproxyssh_t *state = session->client->state;
int rval;
rval = libssh2_userauth_publickey(session->ssh_session,
bdata(session->user),
get_rsa_public_key(session->privkey),
get_rsa_public_key_len(session->privkey),
sign_with_private_key,
&session->privkey);
if (LIBSSH2_ERROR_EAGAIN == rval)
return;
else if (0 != rval) {
log_f(state, "SSH: Error: %s Failed to authenticate - %d",
bdata(session->ssh_addr), rval);
libssh2_session_free(session->ssh_session);
session->ssh_session = NULL;
session_free(session);
return;
}
session->libssh2_cb = ssh_channel_cb;
session->libssh2_cb(session);
}
示例13: socks_relay_teardown_cb
static void
socks_relay_teardown_cb(struct bufferevent *bev, void *ptr)
{
obfsproxyssh_client_session_t *session = ptr;
session_free(session);
}
示例14: connclosed_cb
// This callback is received whenever a session is closed. The RISP session itself will be destroyed right after this callback exits.
void connclosed_cb(RISPSESSION streamsession, void *dataptr)
{
assert(streamsession);
assert(dataptr);
maindata_t *maindata = dataptr;
assert(maindata);
assert(maindata->verify == 0xc001b33f);
// we need to go through the list in maindata, to find this particular session. When we have found it, we remove it.
assert(maindata->sessions.list);
assert(maindata->sessions.max > 0);
fprintf(stderr, "Session Closed. Finding in the list. Max:%d\n", maindata->sessions.max);
short found = 0;
for (int index=0; index < maindata->sessions.max; index++) {
if (maindata->sessions.list[index]) {
if (maindata->sessions.list[index]->session_ptr == streamsession) {
// free the resources used by the session, and the session object itself.
session_free(maindata->sessions.list[index]);
// clear the entry in the list.
maindata->sessions.list[index] = NULL;
// we found the one we were looking for, so mark it, and exit the loop.
found = 1;
index = maindata->sessions.max;
}
}
}
// we should have found one in that list.
assert(found == 1);
}
示例15: freeSession
/**
* Free the memory associated with the session
*
* @param instance The filter instance
* @param session The filter session
*/
static void
freeSession(FILTER *instance, void *session)
{
TEE_SESSION *my_session = (TEE_SESSION *)session;
SESSION* ses = my_session->branch_session;
session_state_t state;
#ifdef SS_DEBUG
skygw_log_write(LOGFILE_TRACE,"Tee free: %d", atomic_add(&debug_seq,1));
#endif
if (ses != NULL)
{
state = ses->state;
if (state == SESSION_STATE_ROUTER_READY)
{
session_free(ses);
}
else if (state == SESSION_STATE_TO_BE_FREED)
{
/** Free branch router session */
ses->service->router->freeSession(
ses->service->router_instance,
ses->router_session);
/** Free memory of branch client session */
ses->state = SESSION_STATE_FREE;
free(ses);
/** This indicates that branch session is not available anymore */
my_session->branch_session = NULL;
}
else if(state == SESSION_STATE_STOPPING)
{
orphan_session_t* orphan;
if((orphan = malloc(sizeof(orphan_session_t))) == NULL)
{
skygw_log_write(LOGFILE_ERROR,"Error : Failed to "
"allocate memory for orphan session struct, "
"child session might leak memory.");
}else{
orphan->session = ses;
spinlock_acquire(&orphanLock);
orphan->next = allOrphans;
allOrphans = orphan;
spinlock_release(&orphanLock);
}
}
}
if (my_session->dummy_filterdef)
{
filter_free(my_session->dummy_filterdef);
}
if(my_session->tee_replybuf)
gwbuf_free(my_session->tee_replybuf);
free(session);
orphan_free(NULL);
return;
}