mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 03:47:53 +08:00
rm manager dir
This commit is contained in:
parent
f676d1d861
commit
1dc2eab9fe
3
Makefile
3
Makefile
@ -119,7 +119,8 @@ clean:
|
||||
@(cd unit_test; make clean)
|
||||
@(cd lib_acl/samples; make clean)
|
||||
@(cd lib_protocol/samples; make clean)
|
||||
@(rm -f libacl_all.a libacl.so)
|
||||
@(rm -f libacl_all.a libacl.a)
|
||||
@(rm -f libacl_all.so libacl.so)
|
||||
# @(cd lib_dict; make clean)
|
||||
# @(cd lib_tls; make clean)
|
||||
|
||||
|
@ -85,8 +85,16 @@ ifneq ($(SYSPATH),)
|
||||
endif
|
||||
###########################################################
|
||||
|
||||
CFLAGS += -I../../../lib_acl/include -I../../../lib_protocol/include
|
||||
LDFLAGS = -L../../../lib_protocol/lib -lprotocol -L../../../lib_acl/lib -lacl $(SYSLIB)
|
||||
ACL_PATH = ../../..
|
||||
|
||||
CFLAGS += -I. \
|
||||
-I$(ACL_PATH)/lib_acl/include \
|
||||
-I$(ACL_PATH)/lib_acl_cpp/include \
|
||||
-I$(ACL_PATH)/lib_protocol/include
|
||||
|
||||
LDFLAGS = -L$(ACL_PATH)/lib_acl_cpp/lib -lacl_cpp \
|
||||
-L$(ACL_PATH)/lib_protocol/lib -lprotocol \
|
||||
-L$(ACL_PATH)/lib_acl/lib -lacl $(SYSLIB)
|
||||
|
||||
COMPILE = $(CC) $(CFLAGS)
|
||||
LINK = $(CC) $(OBJ) $(LDFLAGS)
|
||||
@ -96,7 +104,7 @@ OBJ_PATH = ./debug
|
||||
$(shell mkdir -p $(OBJ_PATH))
|
||||
|
||||
#Project's objs
|
||||
SRC = $(wildcard *.cpp) $(wildcard master/*.cpp) $(wildcard trigger/*.cpp)
|
||||
SRC = $(wildcard *.cpp) $(wildcard master/*.cpp) $(wildcard trigger/*.cpp) $(wildcard manage/*.cpp)
|
||||
OBJ = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(notdir $(SRC)))
|
||||
|
||||
$(OBJ_PATH)/%.o: %.cpp
|
||||
@ -105,6 +113,8 @@ $(OBJ_PATH)/%.o: master/%.cpp
|
||||
$(COMPILE) $< -o $@
|
||||
$(OBJ_PATH)/%.o: trigger/%.cpp
|
||||
$(COMPILE) $< -o $@
|
||||
$(OBJ_PATH)/%.o: manage/%.cpp
|
||||
$(COMPILE) $< -o $@
|
||||
|
||||
.PHONY = all clean
|
||||
all: RM $(OBJ)
|
||||
|
@ -1,123 +0,0 @@
|
||||
/* System libraries. */
|
||||
#include "StdAfx.h"
|
||||
#ifndef ACL_PREPARE_COMPILE
|
||||
|
||||
#include "stdlib/acl_define.h"
|
||||
|
||||
#ifdef ACL_BCB_COMPILER
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ACL_UNIX
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Utility library. */
|
||||
|
||||
#include "stdlib/acl_msg.h"
|
||||
#include "stdlib/acl_iostuff.h"
|
||||
#include "event/acl_events.h"
|
||||
|
||||
/* Application-specific. */
|
||||
|
||||
#include "../../master_proto.h"
|
||||
#include "../../master_params.h"
|
||||
#include "../master.h"
|
||||
|
||||
static ACL_AIO *acl_var_master_manager_aio = NULL;
|
||||
static ACL_ASTREAM *acl_var_master_manager_listener = NULL;
|
||||
|
||||
static MASTER_CONN *master_conn_create(ACL_ASTREAM *conn)
|
||||
{
|
||||
MASTER_CONN *mc = (MASTER_CONN *) acl_mycalloc(1, sizeof(MASTER_CONN));
|
||||
mc->conn = conn;
|
||||
return mc;
|
||||
}
|
||||
|
||||
static void master_conn_free(MASTER_CONN *conn)
|
||||
{
|
||||
acl_myfree(conn);
|
||||
}
|
||||
|
||||
static int http_head_line(MASTER_CONN *mc, const char *data, int dlen)
|
||||
{
|
||||
}
|
||||
|
||||
static int read_callback(ACL_ASTREAM *conn, void *ctx,
|
||||
const char *data, int dlen)
|
||||
{
|
||||
MASTER_CONN *mc = (MASTER_CONN *) ctx;
|
||||
|
||||
switch (mc->status) {
|
||||
case HTTP_S_HEAD_LINE:
|
||||
return http_head_line(mc, data, dlen);
|
||||
case HTTP_S_HEAD_ENTRY:
|
||||
break;
|
||||
case HTTP_S_BODY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int close_callback(ACL_ASTREAM *conn acl_unused, void *ctx)
|
||||
{
|
||||
MASTER_CONN *mc = (MASTER_CONN *) ctx;
|
||||
|
||||
master_conn_free(mc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int timeout_callback(ACL_ASTREAM *conn acl_unused, void *ctx acl_unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int accept_callback(ACL_ASTREAM *conn, void *ctx acl_unused)
|
||||
{
|
||||
MASTER_CONN *mc = master_conn_create(conn);
|
||||
|
||||
mc->status = HTTP_S_HEAD_LINE;
|
||||
|
||||
acl_aio_ctl(conn, ACL_AIO_CTL_READ_HOOK_ADD, read_callback, mc,
|
||||
ACL_AIO_CTL_CLOSE_HOOK_ADD, close_callback, mc,
|
||||
ACL_AIO_CTL_TIMEO_HOOK_ADD, timeout_callback, mc,
|
||||
ACL_AIO_CTL_TIMEOUT, 60,
|
||||
ACL_AIO_CTL_LINE_LENGTH, 8192,
|
||||
ACL_AIO_CTL_END);
|
||||
|
||||
acl_aio_gets(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void acl_master_manager_init(void)
|
||||
{
|
||||
ACL_VSTREAM *sstream =
|
||||
acl_vstream_listen(acl_var_master_manager_addr, 128);
|
||||
|
||||
if (sstream == NULL) {
|
||||
acl_msg_error("%s(%d), %s: listen %s error %s"
|
||||
__FILE__, __LINE__, __FUNCTION__, acl_last_serror());
|
||||
return;
|
||||
}
|
||||
|
||||
if (acl_var_master_global_event == NULL)
|
||||
acl_msg_fatal("%s(%d), %s: global event null",
|
||||
__FILE__, __LINE__, __FUNCTION__);
|
||||
if (acl_var_master_manager_aio == NULL)
|
||||
acl_var_master_manager_aio =
|
||||
acl_aio_create3(acl_var_master_global_event);
|
||||
acl_var_master_manager_listener = acl_aio_open(
|
||||
acl_var_master_manager_aio, sstream);
|
||||
|
||||
acl_aio_ctl(acl_var_master_manager_listener,
|
||||
ACL_AIO_CTL_ACCEPT_FN, accept_callback,
|
||||
ACL_AIO_CTL_END);
|
||||
acl_aio_accept(acl_var_master_manager_listener);
|
||||
}
|
||||
|
||||
#endif /* ACL_UNIX */
|
@ -1,12 +0,0 @@
|
||||
#ifndef ACL_MASTER_MANAGER_INCLUDE_H
|
||||
#define ACL_MASTER_MANAGER_INCLUDE_H
|
||||
|
||||
typedef struct MASTER_CONN {
|
||||
ACL_ASTREAM *conn;
|
||||
int status;
|
||||
#define HTTP_S_HEAD_LINE 0
|
||||
#define HTTP_S_HEAD_ENTRY 1
|
||||
#define HTTP_S_BODY 2
|
||||
} MASTER_CONN;
|
||||
|
||||
#endif
|
@ -3,5 +3,6 @@
|
||||
|
||||
#include "lib_acl.h"
|
||||
#include "lib_protocol.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user