fixed some compile error

This commit is contained in:
zhengshuxin 2017-07-05 00:01:22 +08:00
parent a8ffa2a556
commit 643609a33a
10 changed files with 19 additions and 39 deletions

View File

@ -63,7 +63,7 @@ void service_exit(void *arg acl_unused)
} }
/* 协议处理函数入口 */ /* 协议处理函数入口 */
int service_main(ACL_VSTREAM *client, void *run_ctx acl_unused) int service_main(void *run_ctx acl_unused, ACL_VSTREAM *client)
{ {
char buf[256]; char buf[256];
int ret; int ret;

View File

@ -39,10 +39,10 @@ extern void service_exit(void *exit_ctx);
/** /**
* *
* @param stream {ACL_VSTREAM*}
* @param run_ctx {void*} * @param run_ctx {void*}
* @param stream {ACL_VSTREAM*}
*/ */
extern int service_main(ACL_VSTREAM *stream, void *run_ctx); extern int service_main(void *run_ctx, ACL_VSTREAM *stream);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -32,7 +32,7 @@ static void on_close(ACL_VSTREAM *client, void *arg)
acl_myfree(ctx); acl_myfree(ctx);
} }
int service_on_accept(ACL_VSTREAM *client) int service_on_accept(void *arg acl_unused, ACL_VSTREAM *client)
{ {
MY_CTX *ctx = (MY_CTX*) client->context; MY_CTX *ctx = (MY_CTX*) client->context;
@ -46,7 +46,7 @@ int service_on_accept(ACL_VSTREAM *client)
} }
/* 协议处理函数入口 */ /* 协议处理函数入口 */
int service_main(ACL_VSTREAM *client, void *run_ctx acl_unused) int service_main(void *run_ctx acl_unused, ACL_VSTREAM *client)
{ {
const char *myname = "service_main"; const char *myname = "service_main";
int ret, ready; int ret, ready;

View File

@ -25,14 +25,14 @@ extern void service_exit(void *exit_ctx);
* @param stream {ACL_VSTREAM*} * @param stream {ACL_VSTREAM*}
* @return {int} < 0 * @return {int} < 0
*/ */
extern int service_on_accept(ACL_VSTREAM *client); extern int service_on_accept(void *ctx, ACL_VSTREAM *client);
/** /**
* *
* @param stream {ACL_VSTREAM*} * @param stream {ACL_VSTREAM*}
* @param run_ctx {void*} * @param run_ctx {void*}
*/ */
extern int service_main(ACL_VSTREAM *stream, void *run_ctx); extern int service_main(void *run_ctx, ACL_VSTREAM *stream);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -63,7 +63,7 @@ void service_exit(void *arg acl_unused)
} }
/* 协议处理函数入口 */ /* 协议处理函数入口 */
int service_main(ACL_VSTREAM *client, void *run_ctx acl_unused) int service_main(void *run_ctx acl_unused, ACL_VSTREAM *client)
{ {
char buf[256]; char buf[256];
int ret; int ret;

View File

@ -39,10 +39,10 @@ extern void service_exit(void *exit_ctx);
/** /**
* *
* @param stream {ACL_VSTREAM*}
* @param run_ctx {void*} * @param run_ctx {void*}
* @param stream {ACL_VSTREAM*}
*/ */
extern int service_main(ACL_VSTREAM *stream, void *run_ctx); extern int service_main(void *run_ctx, ACL_VSTREAM *stream);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -17,8 +17,7 @@ static ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
{ 0, 0, 0 }, { 0, 0, 0 },
}; };
static void __service(ACL_VSTREAM *stream, char *service acl_unused, static void __service(void *ctx acl_unused, ACL_VSTREAM *stream)
char **argv acl_unused)
{ {
const char *myname = "__service"; const char *myname = "__service";
char buf[4096]; char buf[4096];

View File

@ -107,24 +107,17 @@ static void __proxy_handle_fn(int type acl_unused, ACL_EVENT *event acl_unused,
} }
} }
static void __service(ACL_VSTREAM *stream, char *service, char **argv) static void __service(void *ctx acl_unused, ACL_VSTREAM *stream)
{ {
const char *myname = "__service"; const char *myname = "__service";
char buf[64]; char buf[64];
int connect_retries = var_proxy_retries; int connect_retries = var_proxy_retries;
/*
* Sanity check. This service takes no command-line arguments.
*/
if (argv[0])
acl_msg_fatal("%s(%d)->%s: unexpected command-line argument: %s",
__FILE__, __LINE__, myname, argv[0]);
__front_stream = stream; __front_stream = stream;
if (var_proxy_log_level > 3) if (var_proxy_log_level > 3)
acl_msg_info("%s(%d)->%s: service name = %s, rw_timeout = %d", acl_msg_info("%s(%d)->%s: rw_timeout = %d",
__FILE__, __LINE__, myname, service, stream->rw_timeout); __FILE__, __LINE__, myname, stream->rw_timeout);
(void) acl_getpeername(ACL_VSTREAM_SOCK(__front_stream), (void) acl_getpeername(ACL_VSTREAM_SOCK(__front_stream),
buf, sizeof(buf)); buf, sizeof(buf));

View File

@ -17,21 +17,10 @@ static ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
{ 0, 0, 0 }, { 0, 0, 0 },
}; };
static void __service(char *buf acl_unused, int len acl_unused, static void __service(void *ctx acl_unused)
char *service, char **argv acl_unused)
{ {
const char *myname = "__service"; const char *myname = "__service";
/*
* Sanity check. This service takes no command-line arguments.
*/
if (argv[0])
acl_msg_fatal("%s(%d)->%s: unexpected command-line argument: %s",
__FILE__, __LINE__, myname, argv[0]);
acl_msg_info("%s(%d), %s: service name = %s, sleep %d, info: %s seconds now---",
__FILE__, __LINE__, myname, service,
var_cfg_sleep_time, var_cfg_dummy);
sleep(var_cfg_sleep_time); sleep(var_cfg_sleep_time);
acl_msg_info("%s: wakeup now", myname); acl_msg_info("%s: wakeup now", myname);
if (var_cfg_create_core) if (var_cfg_create_core)

View File

@ -24,21 +24,20 @@ ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
{ 0, 0, 0 }, { 0, 0, 0 },
}; };
static void __pre_jail_init(char *name acl_unused, char **argv acl_unused) static void __pre_jail_init(void *ctx acl_unused)
{ {
} }
static void __post_jail_init(char *name acl_unused, char **argv acl_unused) static void __post_jail_init(void *ctx acl_unused)
{ {
} }
static void service_exit(char *service acl_unused, char **argv acl_unused) static void service_exit(void *ctx acl_unused)
{ {
} }
/* 协议处理函数入口 */ /* 协议处理函数入口 */
static void service_main(ACL_VSTREAM *client, char *service acl_unused, static void service_main(void *ctx acl_unused, ACL_VSTREAM *client)
char **argv acl_unused)
{ {
char buf[256]; char buf[256];
int ret; int ret;