Merge pull request #60 from nickcooper-zhangtonghao/master

Fix bug when using the redis
This commit is contained in:
logwang 2017-08-25 15:20:40 +08:00 committed by GitHub
commit 9335f1b92e
2 changed files with 16 additions and 12 deletions

View File

@ -3957,17 +3957,17 @@ int main(int argc, char **argv) {
int rc = ff_init(argc, argv); int rc = ff_init(argc, argv);
assert(0 == rc); assert(0 == rc);
ff_mod_init(); ff_mod_init();
//split fstack arguments. int new_argc = argc - 4;
int new_argc = argc - 3;
if (new_argc <= 0) { if (new_argc <= 0) {
new_argc = 1; new_argc = 1;
} }
char **new_argv = zmalloc(sizeof(char *) * new_argc);
char **new_argv = zmalloc(sizeof(char *) * new_argc);
new_argv[0] = argv[0]; new_argv[0] = argv[0];
int i; int i;
for (i = 1; i < new_argc; i++) { for (i = 1; i < new_argc; i++) {
new_argv[i] = argv[i + 3]; new_argv[i] = argv[i + 4];
} }
argv = new_argv; argv = new_argv;
argc = new_argc; argc = new_argc;
#endif #endif

View File

@ -5,6 +5,7 @@ function usage() {
echo "Options:" echo "Options:"
echo " -c [conf] Path of config file" echo " -c [conf] Path of config file"
echo " -b [N] Path of binary" echo " -b [N] Path of binary"
echo " -o [N] Other ARGs for app"
echo " -h show this help" echo " -h show this help"
exit exit
} }
@ -12,7 +13,7 @@ function usage() {
conf=config.ini conf=config.ini
bin=./example/helloworld bin=./example/helloworld
while getopts "c:b:h" args while getopts "c:b:o:h" args
do do
case $args in case $args in
c) c)
@ -21,6 +22,9 @@ do
b) b)
bin=$OPTARG bin=$OPTARG
;; ;;
o)
others=$OPTARG
;;
h) h)
usage usage
exit 0 exit 0
@ -47,11 +51,11 @@ for((proc_id=0; proc_id<${num_procs}; ++proc_id))
do do
if ((proc_id == 0)) if ((proc_id == 0))
then then
echo "${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id}" echo "${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} ${others}"
${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} & ${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} ${others} &
sleep 5 sleep 5
else else
echo "${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id}" echo "${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} ${others}"
${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} & ${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} ${others} &
fi fi
done done