亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ipctransientserver.c

?? linux集群服務器軟件代碼包
?? C
字號:
/* $Id: ipctransientserver.c,v 1.13 2004/11/22 19:03:01 gshi Exp $ *//*  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net> *  * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. *  * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * General Public License for more details. *  * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#undef _GNU_SOURCE  /* in case it was defined on the command line */#define _GNU_SOURCE#include <string.h>#include <errno.h>#include <stdlib.h>#include <unistd.h>#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/wait.h>#include <glib.h>#include <clplumbing/cl_log.h>#include <clplumbing/cl_poll.h>#include <clplumbing/GSource.h>#include <clplumbing/ipc.h>#include <clplumbing/realtime.h>#include <clplumbing/lsb_exitcodes.h>#include <ha_config.h>#include <errno.h>#define	MAXERRORS	    1000#define MAX_IPC_FAIL    10#define WORKING_DIR     HA_VARLIBDIR"/heartbeat/"#define FIFO_LEN        1024gboolean transient_server_callback(IPC_Channel *client, gpointer user_data);gboolean transient_server_connect(IPC_Channel *client_channel, gpointer user_data);IPC_Message *create_simple_message(char *text, IPC_Channel *ch);int init_server_ipc_comms(const char *child,						  gboolean (*channel_client_connect)(IPC_Channel *newclient, gpointer user_data),						  void (*channel_input_destroy)(gpointer user_data),						  gboolean usenormalpoll);void default_ipc_input_destroy(gpointer user_data);intmain(int argc, char ** argv){	int	iteration = 0;    GMainLoop* mainloop = NULL;        cl_log_set_entity("ipc_transient_server_test");    cl_log_enable_stderr(TRUE);        init_server_ipc_comms("echo", transient_server_connect, default_ipc_input_destroy, FALSE);        /* wait for the reply by creating a mainloop and running it until     * the callbacks are invoked...     */    mainloop = g_main_new(FALSE);    cl_log(LOG_INFO, "#--#--#--# Echo Server %d is active...", iteration);    g_main_run(mainloop);    cl_log(LOG_INFO, "#--#--#--# Echo Server %d is stopped...", iteration);        return 0;}intinit_server_ipc_comms(const char *child,					  gboolean (*channel_client_connect)(IPC_Channel *newclient, gpointer user_data),					  void (*channel_input_destroy)(gpointer user_data),					  gboolean usenormalpoll){    /* the clients wait channel is the other source of events.     * This source delivers the clients connection events.     * listen to this source at a relatively lower priority.     */    int local_sock_len = 2; /* 2 = '/' + '\0' */    char    *commpath = NULL;    char path[] = IPC_PATH_ATTR;    mode_t mask;    IPC_WaitConnection *wait_ch;	GHashTable * attrs = g_hash_table_new(g_str_hash,g_str_equal);	    local_sock_len += strlen(child);    local_sock_len += strlen(WORKING_DIR);        commpath = (char*)malloc(sizeof(char)*local_sock_len);    if (commpath == NULL){	    cl_log(LOG_ERR, "init_server_ipc_comms:"		   " allocating memory failed");	    exit(1);    }    sprintf(commpath, WORKING_DIR "/%s", child);    commpath[local_sock_len - 1] = '\0';    g_hash_table_insert(attrs, path, commpath);        mask = umask(0);    wait_ch = ipc_wait_conn_constructor(IPC_ANYTYPE, attrs);    if (wait_ch == NULL){	    cl_perror("[Server] Can't create wait channel of type %s", IPC_ANYTYPE);	    exit(1);    }    mask = umask(mask);    g_hash_table_destroy(attrs);	G_main_add_IPC_WaitConnection(G_PRIORITY_LOW,								  wait_ch,								  NULL,								  FALSE,								  channel_client_connect,								  wait_ch, /* user data passed to ?? */								  channel_input_destroy);    cl_log(LOG_INFO, "[Server] Listening on: %s", commpath);/*     if (!usenormalpoll) { *//* 		g_main_set_poll_func(cl_glibpoll); *//* 		ipc_set_pollfunc(cl_poll); *//*     } */    return 0;}voiddefault_ipc_input_destroy(gpointer user_data){    cl_log(LOG_INFO, "default_ipc_input_destroy:received HUP");}gbooleantransient_server_callback(IPC_Channel *client, gpointer user_data){    int lpc = 0;    IPC_Message *msg = NULL;    char *buffer = NULL;    IPC_Message *reply = NULL;    int llpc = 0;    cl_log(LOG_DEBUG, "channel: %p", client);    cl_log(LOG_DEBUG, "Client status %d (disconnect=%d)", client->ch_status, IPC_DISCONNECT);    while(client->ops->is_message_pending(client)) {    		if (client->ch_status == IPC_DISCONNECT) {			/* The message which was pending for us is that			 * the IPC status is now IPC_DISCONNECT */			break;	        }		if(client->ops->recv(client, &msg) != IPC_OK) {			cl_perror("[Server] Receive failure");			return FALSE;		}				if(msg != NULL){			lpc++;			buffer = (char*)g_malloc(msg->msg_len+1);			memcpy(buffer,msg->msg_body, msg->msg_len);			buffer[msg->msg_len] = '\0';			cl_log(LOG_DEBUG, "[Server] Got xml [text=%s]", buffer);						reply = create_simple_message(strdup(buffer), client);						llpc = 0;			while(llpc++ < MAX_IPC_FAIL && client->ops->send(client, reply) == IPC_FAIL) {				cl_log(LOG_WARNING, "[Server] ipc channel blocked");				cl_shortsleep();			}						if(lpc == MAX_IPC_FAIL) {				cl_log(LOG_ERR, "[Server] Could not send IPC, message.  Channel is dead.");				return FALSE;			}						cl_log(LOG_DEBUG, "[Server] Sent reply");			msg->msg_done(msg);		} else {			cl_log(LOG_ERR, "[Server] No message this time");			continue;		}    }    cl_log(LOG_DEBUG, "[Server] Processed %d messages", lpc);        cl_log(LOG_DEBUG, "[Server] Client status %d", client->ch_status);    if(client->ch_status != IPC_CONNECT) {		cl_log(LOG_INFO, "[Server] Server received HUP from child");		return FALSE;    }    	     return TRUE;}gbooleantransient_server_connect(IPC_Channel *client_channel, gpointer user_data){    /* assign the client to be something, or put in a hashtable */    cl_log(LOG_DEBUG, "A client tried to connect... and there was much rejoicing.");    if(client_channel == NULL) {		cl_log(LOG_ERR, "[Server] Channel was NULL");    } else if(client_channel->ch_status == IPC_DISCONNECT) {		cl_log(LOG_ERR, "[Server] Channel was disconnected");    } else {		cl_log(LOG_DEBUG, "[Server] Client is %s %p", client_channel == NULL?"NULL":"valid", client_channel);		cl_log(LOG_DEBUG, "[Server] Client status %d (disconnect=%d)", client_channel->ch_status, IPC_DISCONNECT);				cl_log(LOG_DEBUG, "[Server] Adding IPC Channel to main thread.");		G_main_add_IPC_Channel(G_PRIORITY_LOW,							   client_channel,							   FALSE, 							   transient_server_callback,							   NULL,							   default_ipc_input_destroy);    }        return TRUE;}IPC_Message *create_simple_message(char *text, IPC_Channel *ch){    IPC_Message *ack_msg = NULL;    char *copy_text = NULL;    if(text == NULL) {		cl_log(LOG_ERR, "ERROR: can't create IPC_Message with no text");		return NULL;	} else if(ch == NULL) {		cl_log(LOG_ERR, "ERROR: can't create IPC_Message with no channel");		return NULL;	}    ack_msg = (IPC_Message *)malloc(sizeof(IPC_Message));    if (ack_msg == NULL){	    cl_log(LOG_ERR, "create_simple_message:"		   "allocating memory for IPC_Message failed");			    return NULL;    }        memset(ack_msg, 0, sizeof(IPC_Message));        copy_text = strdup(text);        ack_msg->msg_private = NULL;    ack_msg->msg_done    = NULL;    ack_msg->msg_body    = copy_text;    ack_msg->msg_ch      = ch;    ack_msg->msg_len = strlen(text)+1;        return ack_msg;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久久果冻传媒| 欧美日韩国产片| 国产午夜亚洲精品不卡| 国产乱理伦片在线观看夜一区| 欧美成人一级视频| 九九精品视频在线看| 久久中文娱乐网| 不卡av免费在线观看| 亚洲欧美自拍偷拍| 日本乱人伦aⅴ精品| 亚洲国产日韩a在线播放| 9191成人精品久久| 国产精品亚洲第一区在线暖暖韩国 | 久久久国产精品不卡| 奇米色777欧美一区二区| 日韩视频一区二区三区在线播放 | 处破女av一区二区| 欧美韩国日本不卡| 99国产欧美另类久久久精品| 国产精品对白交换视频| 99久久综合狠狠综合久久| 日本一区二区三区免费乱视频| 老色鬼精品视频在线观看播放| 欧美成人一区二区三区片免费| 国产精品123区| 国产精品萝li| 欧美在线观看18| 天堂午夜影视日韩欧美一区二区| k8久久久一区二区三区| 亚洲免费电影在线| 91福利资源站| 亚洲影视在线观看| 欧美精品自拍偷拍| 捆绑变态av一区二区三区 | 精品国产乱码久久久久久蜜臀 | 图片区日韩欧美亚洲| 欧美一级免费观看| 国产成人精品影视| 亚洲欧美日韩一区二区三区在线观看| 在线欧美小视频| 丝袜美腿亚洲色图| 国产欧美日韩久久| 欧美亚洲一区二区在线| 激情小说欧美图片| 玉足女爽爽91| 久久影院视频免费| 色94色欧美sute亚洲线路二 | 亚洲一区二区三区小说| 欧美不卡123| 91色porny| 久久99精品国产麻豆婷婷洗澡| 久久精品视频免费| 欧美伦理视频网站| 国产精品66部| 日韩经典中文字幕一区| 中文字幕欧美日韩一区| 91.xcao| 色综合久久九月婷婷色综合| 亚洲国产一区二区a毛片| 精品sm在线观看| 一本大道久久a久久综合| 国产激情一区二区三区四区| 国产精品久久国产精麻豆99网站| 日韩一区二区在线免费观看| 一本大道综合伊人精品热热| 日本vs亚洲vs韩国一区三区| 国产欧美日韩精品一区| 欧美一级欧美三级在线观看| 色狠狠综合天天综合综合| 国产成人综合精品三级| 奇米四色…亚洲| 亚洲成在人线在线播放| 亚洲人成网站精品片在线观看| 国产亚洲欧洲一区高清在线观看| 欧美高清激情brazzers| 色婷婷久久久久swag精品 | 久久97超碰国产精品超碰| 一区二区三区毛片| 成人免费在线视频| 国产精品素人视频| 国产性色一区二区| 精品久久久久久久久久久久包黑料| 欧美日韩视频在线一区二区 | 色一区在线观看| 不卡的看片网站| 国产成人自拍网| 国产精品一级黄| 精油按摩中文字幕久久| 蜜臀av亚洲一区中文字幕| 三级久久三级久久| 日韩经典一区二区| 日本午夜一本久久久综合| 午夜亚洲国产au精品一区二区| 一区二区三区 在线观看视频| 综合在线观看色| 亚洲日本在线视频观看| 国产精品免费久久| 日韩一区在线看| 亚洲男人的天堂网| 亚洲免费在线播放| 亚洲自拍偷拍网站| 亚洲bdsm女犯bdsm网站| 亚洲成a人片综合在线| 香蕉影视欧美成人| 日韩福利视频导航| 久久精品国产在热久久| 亚洲自拍偷拍综合| 亚洲线精品一区二区三区| 亚洲国产一区二区视频| 视频一区二区不卡| 久久成人麻豆午夜电影| 久久国产尿小便嘘嘘| 精品一区二区成人精品| 国产在线视频一区二区| 色域天天综合网| 99国产精品视频免费观看| 在线免费不卡电影| 91麻豆精品久久久久蜜臀| 日韩精品一区在线| 欧美国产亚洲另类动漫| 一区二区三区精品视频在线| 亚洲大片精品永久免费| 久久疯狂做爰流白浆xx| 风间由美中文字幕在线看视频国产欧美| 成人av网在线| 欧美日韩一级二级三级| 欧美大片日本大片免费观看| 国产精品无遮挡| 午夜在线成人av| 国产精品一区在线| 欧美亚洲高清一区| 精品乱码亚洲一区二区不卡| 国产欧美日本一区视频| 亚洲综合男人的天堂| 久久97超碰色| 一本久久精品一区二区| 欧美一卡二卡三卡| 国产精品乱码一区二区三区软件| 一区二区高清在线| 九九视频精品免费| 欧美又粗又大又爽| 国产欧美一区二区三区鸳鸯浴 | 国产精品对白交换视频| 亚洲成人免费电影| 国产精品一区二区免费不卡| 在线欧美日韩国产| 久久精品一区二区三区不卡| 亚洲三级视频在线观看| 麻豆国产一区二区| 成人午夜视频福利| 在线观看视频一区| 国产日本欧洲亚洲| 秋霞午夜鲁丝一区二区老狼| 99国产精品久久久久久久久久| 欧美一区二区三区四区久久 | 精品国产91亚洲一区二区三区婷婷| 1024成人网| 九一久久久久久| 91蜜桃在线免费视频| 国产精品亲子伦对白| 免费欧美在线视频| 在线视频国内一区二区| 国产精品免费人成网站| 国产一区二区毛片| 欧美大片免费久久精品三p| 亚洲第一电影网| 91麻豆产精品久久久久久| 中文字幕精品综合| 国产剧情一区二区| 精品国产亚洲在线| 视频在线观看国产精品| 91久久精品一区二区二区| 国产欧美精品一区二区色综合 | 色视频成人在线观看免| 精品视频1区2区| 亚洲精品中文在线| 99re视频精品| 国产精品久久777777| 成人中文字幕合集| 久久精品人人做人人爽人人| 国产资源在线一区| 精品国产乱码久久久久久老虎 | 久久久久久久综合狠狠综合| 麻豆精品精品国产自在97香蕉| 欧美另类z0zxhd电影| 亚洲宅男天堂在线观看无病毒| 99精品黄色片免费大全| 国产精品黄色在线观看| www.亚洲人| 亚洲欧美日韩国产另类专区| 成人av网在线| 亚洲男同1069视频| 91丝袜美腿高跟国产极品老师 | 精品午夜久久福利影院| 日韩视频一区二区三区在线播放| 麻豆国产精品官网| 久久一区二区三区四区| 国产精品小仙女| 国产精品女主播在线观看| 91亚洲精品久久久蜜桃|