本文整理汇总了C++中session_init函数的典型用法代码示例。如果您正苦于以下问题:C++ session_init函数的具体用法?C++ session_init怎么用?C++ session_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了session_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
session *s;
session_init(&argc, &argv, &s, "Pingpong_A.spr");
if (argc < 3) return EXIT_FAILURE;
int M = atoi(argv[1]);
int N = atoi(argv[2]);
printf("M: %d, N: %d\n", M, N);
role *B = s->r(s, "B");
int val[M];
size_t sz = M;
long long start_time = sc_time();
int i;
for (i=0; i<N; i++) {
memset(val, i, M * sizeof(int));
send_int_array(val, (size_t)M, B);
sz = M;
recv_int_array(val, &sz, B);
}
long long end_time = sc_time();
printf("%s: Time elapsed: %f sec\n", s->name, sc_time_diff(start_time, end_time));
session_end(s);
return EXIT_SUCCESS;
}
开发者ID:sessionc,项目名称:MPI-Type-checker,代码行数:33,代码来源:a.c
示例2: main
int main () {
char * request_uri;
/* Load the controller .so from this sub directory */
route_import_controllers("controllers/");
/* Initialize session system */
session_init();
while (FCGI_Accept() >= 0) {
/* Record start time */
gettimeofday(&start_time,NULL);
request_uri = cleanrequest( getenv("REQUEST_URI"));
/* Initialize session for this request */
fprintf(stderr, "Request for %s\n", request_uri );
/* Dispatch the request to the correct controller */
route_dispatch(request_uri);
free(request_uri);
/* Calculate total runtime of the operation */
gettimeofday(&end_time,NULL);
timeval_diff( &difference_time, &end_time, &start_time );
printf("time: %ld.%06ld\n", difference_time.tv_sec, difference_time.tv_usec);
FCGI_Finish();
}
fprintf(stderr, "FF Exiting\n");
return 0;
}
开发者ID:adamsch1,项目名称:ff,代码行数:34,代码来源:main.c
示例3: client
static void client(int sock)
{
int err = 0;
time_t started = time(0);
const char* line = "foobar!";
char buffer[8192];
int len;
session_init(sock, 0);
killtimer_set();
do {
err = process_error(gnutls_handshake(session));
if (err != 0) {
int t = gnutls_dtls_get_timeout(session);
await(sock, t ? t : 100);
}
} while (err != 0);
process_error_or_timeout(err, time(0) - started);
killtimer_set();
die_on_error(gnutls_record_send(session, line, strlen(line)));
do {
await(sock, -1);
len = process_error(gnutls_record_recv(session, buffer, sizeof(buffer)));
} while (len < 0);
if (len > 0 && strncmp(line, buffer, len) == 0) {
exit(0);
} else {
exit(1);
}
}
开发者ID:intgr,项目名称:gnutls,代码行数:34,代码来源:dtls-stress.c
示例4: init_full
bool init_full(void)
{
int error;
error = pool6_init(NULL, 0);
if (error)
goto fail;
error = pool4_init(NULL, 0);
if (error)
goto fail;
error = bib_init();
if (error)
goto fail;
error = session_init(session_expired_callback);
if (error)
goto fail;
error = filtering_init();
if (error)
goto fail;
return true;
fail:
return false;
}
开发者ID:kuldeepin,项目名称:NAT64,代码行数:25,代码来源:filtering_and_updating_test.c
示例5: sessiondb_init
int sessiondb_init(fate_cb tcpest_fn, fate_cb tcptrans_fn)
{
int error;
error = session_init();
if (error)
return error;
error = pktqueue_init();
if (error) {
session_destroy();
return error;
}
sessiontable_init(&session_table_udp,
config_get_ttl_udp, just_die,
NULL, NULL);
sessiontable_init(&session_table_tcp,
config_get_ttl_tcpest, tcpest_fn,
config_get_ttl_tcptrans, tcptrans_fn);
sessiontable_init(&session_table_icmp,
config_get_ttl_icmp, just_die,
NULL, NULL);
return 0;
}
开发者ID:pandax381,项目名称:NAT64,代码行数:25,代码来源:db.c
示例6: server
static void server(int sock)
{
int err;
time_t started = time(0);
char buffer[8192];
int len;
session_init(sock, 1);
await(sock, -1);
killtimer_set();
do {
err = process_error(gnutls_handshake(session));
if (err != 0) {
int t = gnutls_dtls_get_timeout(session);
await(sock, t ? t : 100);
}
} while (err != 0);
process_error_or_timeout(err, time(0) - started);
killtimer_set();
do {
await(sock, -1);
len = process_error(gnutls_record_recv(session, buffer, sizeof(buffer)));
} while (len < 0);
die_on_error(gnutls_record_send(session, buffer, len));
exit(0);
}
开发者ID:intgr,项目名称:gnutls,代码行数:30,代码来源:dtls-stress.c
示例7: 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;
}
}
}
开发者ID:1100101,项目名称:Automatic,代码行数:27,代码来源:automatic.c
示例8: cm_return_val_if_fail
Session *pop3_session_new(PrefsAccount *account)
{
Pop3Session *session;
cm_return_val_if_fail(account != NULL, NULL);
account->receive_in_progress = TRUE;
session = g_new0(Pop3Session, 1);
session_init(SESSION(session), account, FALSE);
SESSION(session)->type = SESSION_POP3;
SESSION(session)->recv_msg = pop3_session_recv_msg;
SESSION(session)->recv_data_finished = pop3_session_recv_data_finished;
SESSION(session)->send_data_finished = NULL;
SESSION(session)->ssl_cert_auto_accept = account->ssl_certs_auto_accept;
SESSION(session)->destroy = pop3_session_destroy;
session->state = POP3_READY;
session->ac_prefs = account;
session->pop_before_smtp = FALSE;
pop3_get_uidl_table(account, session);
session->current_time = time(NULL);
session->error_val = PS_SUCCESS;
session->error_msg = NULL;
return SESSION(session);
}
开发者ID:ignatenkobrain,项目名称:claws,代码行数:30,代码来源:pop.c
示例9: init
bool init(void)
{
int error;
int i;
for (i = 0; i < ARRAY_SIZE(IPV4_ADDRS); i++) {
error = str_to_addr4(IPV4_ADDRS[i], &addr4[i].address);
if (error)
return false;
addr4[i].l4_id = IPV4_PORTS[i];
}
for (i = 0; i < ARRAY_SIZE(IPV4_ADDRS); i++) {
error = str_to_addr6(IPV6_ADDRS[i], &addr6[i].address);
if (error)
return false;
addr6[i].l4_id = IPV6_PORTS[i];
}
error = bib_init();
if (error)
return false;
error = session_init(session_always_dies);
if (error) {
bib_destroy();
return false;
}
return true;
}
开发者ID:kuldeepin,项目名称:NAT64,代码行数:31,代码来源:bib_session_test.c
示例10: session_start
void session_start(struct session *s){
debug("session_start");
http_parser_init(s->client_parser, HTTP_REQUEST);
http_parser_init(s->server_parser, HTTP_RESPONSE);
s->client_parser->data = s;
s->server_parser->data = s;
session_init(s);
}
开发者ID:noikiy,项目名称:bscope,代码行数:8,代码来源:session.c
示例11: _init
static void
_init(char *log_level)
{
setlocale(LC_ALL, "");
// ignore SIGPIPE
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGWINCH, ui_sigwinch_handler);
if (pthread_mutex_init(&lock, NULL) != 0) {
log_error("Mutex init failed");
exit(1);
}
pthread_mutex_lock(&lock);
files_create_directories();
log_level_t prof_log_level = log_level_from_string(log_level);
prefs_load();
log_init(prof_log_level);
log_stderr_init(PROF_LEVEL_ERROR);
if (strcmp(PACKAGE_STATUS, "development") == 0) {
#ifdef HAVE_GIT_VERSION
log_info("Starting Profanity (%sdev.%s.%s)...", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
#else
log_info("Starting Profanity (%sdev)...", PACKAGE_VERSION);
#endif
} else {
log_info("Starting Profanity (%s)...", PACKAGE_VERSION);
}
chat_log_init();
groupchat_log_init();
accounts_load();
char *theme = prefs_get_string(PREF_THEME);
theme_init(theme);
prefs_free_string(theme);
ui_init();
session_init();
cmd_init();
log_info("Initialising contact list");
muc_init();
tlscerts_init();
scripts_init();
#ifdef HAVE_LIBOTR
otr_init();
#endif
#ifdef HAVE_LIBGPGME
p_gpg_init();
#endif
#ifdef HAVE_OMEMO
omemo_init();
#endif
atexit(_shutdown);
plugins_init();
#ifdef HAVE_GTK
tray_init();
#endif
inp_nonblocking(TRUE);
ui_resize();
}
开发者ID:boothj5,项目名称:profanity,代码行数:58,代码来源:profanity.c
示例12: init_spotify
PyMODINIT_FUNC
init_spotify(void)
{
PyObject *m;
if (PyType_Ready(&SessionType) < 0)
return;
if (PyType_Ready(&ArtistType) < 0)
return;
if (PyType_Ready(&ArtistBrowserType) < 0)
return;
if (PyType_Ready(&LinkType) < 0)
return;
if (PyType_Ready(&PlaylistType) < 0)
return;
if (PyType_Ready(&PlaylistContainerType) < 0)
return;
if (PyType_Ready(&ResultsType) < 0)
return;
if (PyType_Ready(&ToplistBrowserType) < 0)
return;
if (PyType_Ready(&TrackType) < 0)
return;
if (PyType_Ready(&ImageType) < 0)
return;
if (PyType_Ready(&UserType) < 0)
return;
m = Py_InitModule("_spotify", module_methods);
if (m == NULL)
return;
PyObject *spotify = PyImport_ImportModule("spotify");
PyObject *d = PyModule_GetDict(spotify);
PyObject *s = PyUnicode_FromString("SpotifyError");
SpotifyError = PyDict_GetItem(d, s);
Py_INCREF(SpotifyError);
SpotifyApiVersion = Py_BuildValue("i", SPOTIFY_API_VERSION);
Py_INCREF(SpotifyApiVersion);
PyModule_AddObject(m, "api_version", SpotifyApiVersion);
album_init(m);
albumbrowser_init(m);
artist_init(m);
artistbrowser_init(m);
link_init(m);
playlist_init(m);
playlistcontainer_init(m);
session_init(m);
search_init(m);
toplistbrowser_init(m);
track_init(m);
image_init(m);
user_init(m);
}
开发者ID:JoeConyers,项目名称:SpotifyRemote,代码行数:56,代码来源:module.c
示例13: core_init
void core_init(void)
{
dialog_type_queue = NULL;
dialog_text_queue = NULL;
client_start_time = time(NULL);
modules_init();
pidwait_init();
net_disconnect_init();
signals_init();
signal_add_first("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
signal_add_first("irssi init finished", (SIGNAL_FUNC) sig_init_finished);
settings_init();
commands_init();
nickmatch_cache_init();
session_init();
#ifdef HAVE_CAPSICUM
capsicum_init();
#endif
chat_protocols_init();
chatnets_init();
expandos_init();
ignore_init();
servers_init();
write_buffer_init();
log_init();
log_away_init();
rawlog_init();
recode_init();
channels_init();
queries_init();
nicklist_init();
chat_commands_init();
wcwidth_wrapper_init();
settings_add_str("misc", "ignore_signals", "");
settings_add_bool("misc", "override_coredump_limit", FALSE);
#ifdef HAVE_SYS_RESOURCE_H
getrlimit(RLIMIT_CORE, &orig_core_rlimit);
#endif
read_settings();
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
settings_check();
module_register("core", "core");
}
开发者ID:ailin-nemui,项目名称:irssi,代码行数:55,代码来源:core.c
示例14: main
int main(int argc, char const *argv[])
{
check_permission();
setup_signal_chld();
parseconf_load_file("ftpserver.conf");
print_conf();
init_hash();
//创建一个监听fd
int listenfd = tcp_server(tunable_listen_address, tunable_listen_port);
pid_t pid;
session_t sess;
session_init(&sess);
p_sess = &sess; //配置全局变量
while(1)
{
struct sockaddr_in addr;
int peerfd = accept_timeout(listenfd, &addr, tunable_accept_timeout);
if(peerfd == -1 && errno == ETIMEDOUT)
continue;
else if(peerfd == -1)
ERR_EXIT("accept_timeout");
//获取ip地址,并在hash中添加一条记录
uint32_t ip = addr.sin_addr.s_addr;
sess.ip = ip;
add_clients_to_hash(&sess, ip);
if((pid = fork()) == -1)
ERR_EXIT("fork");
else if(pid == 0)
{
close(listenfd);
sess.peerfd = peerfd;
limit_num_clients(&sess);
session_begin(&sess);
exit(EXIT_SUCCESS);
}
else
{
//pid_to_ip
add_pid_ip_to_hash(pid, ip);
close(peerfd);
}
}
return 0;
}
开发者ID:chenfan2014,项目名称:CFgit,代码行数:54,代码来源:main.c
示例15: session_new
/*
* Allocate memory for a new session and add it to the sessions linked list.
*/
session *
session_new(void)
{
session *s = (session *)xmalloc(sizeof(session));
session_init(s);
sessions = list_append(sessions, s);
return s;
}
开发者ID:Stanpol,项目名称:imapfilter,代码行数:14,代码来源:session.c
示例16: main
int main(int argc, char *argv[])
{
if (getuid()) {
fprintf(stderr, "the ftpserver must started by root\n");
exit(EXIT_FAILURE);
}
if (signal(SIGCHLD, handle_sigchld) == SIG_ERR)
ERR_EXIT("signal");
parse_load_file("ftpserver.conf");
printf("parse_load_file success\n");
// printconfig();
ip_to_clients = hash_alloc(256, hash_func);
pid_to_ip = hash_alloc(256, hash_func);
int listenfd;
listenfd = tcp_server(listen_address, listen_port);
printf("tcp_server success, listenfd = %d\n", listenfd);
int connfd;
pid_t pid;
session_t sess;
while (1) {
struct sockaddr_in addr;
connfd = accept_time_out(listenfd, &addr, accept_timeout);
if (connfd == -1) {
// printf("don't has connection in %d seconds\n", accept_timeout);
continue;
}
uint32_t ip = addr.sin_addr.s_addr;
printf("connect success\n");
session_init(&sess);
num_of_clients++;
sess.curr_clients = num_of_clients;
sess.curr_ip_clients = add_ip_to_hash(ip_to_clients, ip);
sess.ip = ip;
p_sess = &sess;
pid = fork();
if (pid == -1) {
ERR_EXIT("fork error");
} else if (pid == 0) { //子进程
close(listenfd);
sess.peerfd = connfd;
session_begin(&sess); //建立一个会话
exit(EXIT_SUCCESS);
} else { //父进程
close(connfd);
hash_add_entry(pid_to_ip, &pid, sizeof(pid), &ip, sizeof(ip));
}
}
return 0;
}
开发者ID:zhanjl,项目名称:Myftpserver,代码行数:54,代码来源:main.c
示例17: main
int main(int argc, char *argv[])
{
enum { SC = 3 };
int opt, n;
int sigs[] = { SIGINT, SIGHUP, SIGTERM };
void (*sighandlers[])() = { sigint_handler,
sighup_handler,
sigterm_handler };
struct sigaction s[SC];
for (n = 0; n < SC; ++n)
{
s[n].sa_handler = SIG_IGN;
sigfillset(&s[n].sa_mask);
s[n].sa_flags = 0;
sigaction(sigs[n], &s[n], NULL);
}
for (opt = 1; opt < argc; ++opt)
{
if (strcmp(argv[opt], "-h") == 0
|| strcmp(argv[opt], "--help") == 0)
{
show_usage();
return 0;
}
}
mod_src_create();
gtk_init(&argc, &argv);
settings_init();
driver_init();
lfo_tables_init();
mixer_init();
patch_control_init();
dish_file_state_init();
session_init(argc, argv);
gui_init();
for (n = 0; n < SC; ++n)
{
s[n].sa_handler = sighandlers[n];
sigfillset(&s[n].sa_mask);
s[n].sa_flags = 0;
sigaction(sigs[n], &s[n], NULL);
}
gtk_main();
cleanup();
return 0;
}
开发者ID:jphaenlin,项目名称:Petri-Foo,代码行数:53,代码来源:petri-foo.c
示例18: init
static bool init(void)
{
if (config_init(false))
return false;
if (session_init()) {
config_destroy();
return false;
}
sessiontable_init(&table, config_get_ttl_udp, just_die, NULL, NULL);
return true;
}
开发者ID:pandax381,项目名称:NAT64,代码行数:12,代码来源:sessiontable_test.c
示例19: core_init
void core_init(int argc, char *argv[])
{
dialog_type_queue = NULL;
dialog_text_queue = NULL;
modules_init();
#ifndef WIN32
pidwait_init();
#endif
net_disconnect_init();
net_sendbuffer_init();
signals_init();
signal_add_first("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
signal_add_first("irssi init finished", (SIGNAL_FUNC) sig_init_finished);
settings_init();
commands_init();
nickmatch_cache_init();
session_init();
chat_protocols_init();
chatnets_init();
expandos_init();
ignore_init();
servers_init();
write_buffer_init();
log_init();
log_away_init();
rawlog_init();
recode_init();
channels_init();
queries_init();
nicklist_init();
chat_commands_init();
settings_add_str("misc", "ignore_signals", "");
settings_add_bool("misc", "override_coredump_limit", TRUE);
#ifdef HAVE_SYS_RESOURCE_H
getrlimit(RLIMIT_CORE, &orig_core_rlimit);
#endif
read_settings();
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
settings_check();
module_register("core", "core");
}
开发者ID:svn2github,项目名称:irssi,代码行数:53,代码来源:core.c
示例20: init_full
bool init_full(void)
{
bool success = true;
success &= pool6_init();
success &= pool4_init(true);
success &= bib_init();
success &= session_init();
success &= filtering_init();
return success;
}
开发者ID:edygarza,项目名称:NAT64,代码行数:12,代码来源:filtering_and_updating_test.c
注:本文中的session_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论