Qiuyang 2 månader sedan
förälder
incheckning
32703833eb

+ 1 - 1
CMakeLists.txt

@@ -12,7 +12,7 @@ add_compile_options(-DRELEASE)
 
 # --[ Options
 option(build_modules "build modules" ON)
-option(build_source "build source programs" ON)
+option(build_source "build source programs" OFF)
 option(build_plugins "build plugins programs" ON)
 option(build_test "build test programs" ON)
 

BIN
lib/libgsd_core.so


BIN
lib/libgsd_modules.so


BIN
lib/libgsd_plugins.so


+ 9 - 9
modules/CMakeLists.txt

@@ -16,15 +16,15 @@ endif()
 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_REENTRANT -fPIC -Wall -Werror")
 
 # ---[ Options
-option(build_Expel "build module Expel" ON)
-option(build_HttpClient "build module HttpClient" ON)
-option(build_InfineFilter "build module InfineFilter" ON)
-option(build_Monitor "build module Monitor" ON)
-option(build_TCPClient "build module TCPClient" ON)
-option(build_config "build module config" ON)
-option(build_HttpServer "build module HttpServer" ON)
-option(build_Audit "build module Audit" ON)
-option(build_kafka "build module kafka" ON)
+option(build_Expel "build module Expel" OFF)
+option(build_HttpClient "build module HttpClient" OFF)
+option(build_InfineFilter "build module InfineFilter" OFF)
+option(build_Monitor "build module Monitor" OFF)
+option(build_TCPClient "build module TCPClient" OFF)
+option(build_config "build module config" OFF)
+option(build_HttpServer "build module HttpServer" OFF)
+option(build_Audit "build module Audit" OFF)
+option(build_kafka "build module kafka" OFF)
 option(build_Hepu "build module Hepu" ON)
 
 # ---[ 3rdparty

+ 8 - 0
modules/Hepu/src/Hepu.cpp

@@ -35,6 +35,8 @@ namespace gsd{
         hepuloginMsg.objectToJson(msg);
         msg += "\r\n";
 
+        //cout<<msg<<endl;
+
         if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
             if(res->status != 100){
                 HepuLoginRe hepuloginReMsg;
@@ -70,6 +72,8 @@ namespace gsd{
         hepuHBMsg.token = this->token;
         hepuHBMsg.objectToJson(msg);
         msg+="\r\n";
+        
+        //cout<<msg<<endl;
 
         if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
             if(res->status != 100){
@@ -99,6 +103,8 @@ namespace gsd{
         hepuHBMsg.token = this->token;
         hepuHBMsg.objectToJson(msg);
         msg+="\r\n";
+        
+        //cout<<msg<<endl;
 
         if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
             if(res->status != 100){
@@ -127,6 +133,8 @@ namespace gsd{
         HepuTargetMsg.token = this->token;
         HepuTargetMsg.objectToJson(msg);
         msg+="\r\n";
+        
+        //cout<<msg<<endl;
 
         if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
             if(res->status != 100){

+ 6 - 6
plugins/CMakeLists.txt

@@ -16,13 +16,13 @@ endif()
 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_REENTRANT -fPIC -Wall -Werror")
 
 # ---[ Options
-option(build_ExpelPlugin "build module ExpelPlugin" ON)
-option(build_HttpPlugin "build module HttpPlugin" ON)
-option(build_MonitorPlugin "build module MonitorPlugin" ON)
-option(build_TcpPlugin "build module TcpPlugin" ON)
-option(build_AuditPlugin "build module AuditPlugin" ON)
+option(build_ExpelPlugin "build module ExpelPlugin" OFF)
+option(build_HttpPlugin "build module HttpPlugin" OFF)
+option(build_MonitorPlugin "build module MonitorPlugin" OFF)
+option(build_TcpPlugin "build module TcpPlugin" OFF)
+option(build_AuditPlugin "build module AuditPlugin" OFF)
 option(build_HepuPlugin "build module HepuPlugin" ON)
-option(build_kafka "build module kafka" ON)
+option(build_kafka "build module kafka" OFF)
 
 
 # ---[ 3rdparty

+ 2 - 0
plugins/HepuPlugin/include/HepuPlugin.hpp

@@ -2,6 +2,8 @@
 #define __HEPUPLUGHIN_HPP_
 
 #include <iostream>
+#include <ctime>
+#include <chrono>
 #include "UtilBase.hpp"
 #include "Util/util.h"  
 #include "Util/logger.h"

+ 5 - 0
plugins/HepuPlugin/src/HepuPlugin.cpp

@@ -9,16 +9,19 @@ namespace gsd
     }
 
     bool HepuPlugin::Init(){
+        cout<<"Creat HEPU object."<<endl;
         if(this->m_hepuClient == nullptr){
             this->m_hepuClient = Hepu::CreateNew();
         }
 
+        cout<<"Connect to IPC"<<endl;
         if(this->m_hepuClient->Init(HEPU_USR,HEPU_IP,HEPU_PORT) == OK){
             InfoL << "Hepu IPC http login succeeds."<<endl;
         }else{
             WarnL << "Hepu IPC http login failed."<<endl;
         }
 
+        cout<<"Assign pool"<<endl;
         if(this->pool == nullptr){
             this->pool = std::make_shared<ThreadPool>(1,ThreadPool::PRIORITY_NORMAL,false);
         }
@@ -34,11 +37,13 @@ namespace gsd
                 if(this->PluginAlive) this->HBThrd();
             }
         });
+        cout<<"Pool start"<<endl;
         this->pool->start();
         return true;
     }
 
     void HepuPlugin::HBThrd(){
+        InfoL<<"Send Heartbeat "<<endl;
         if(this->m_hepuClient == nullptr) return;
         this->m_hepuClient->sendHepuHB();
         sleep(10);

+ 1 - 4
test/CMakeLists.txt

@@ -87,10 +87,7 @@ aux_source_directory(${CNSTREAM_ROOT_DIR}/test/src tests)
 aux_source_directory(${CNSTREAM_ROOT_DIR}/test/TestApp/src testApps)
 
 # ---[ add targets
-# set(EXECUTABLE_OUTPUT_PATH ${TEST_ROOT_DIR}/bin)
-
-#add_executable(gsd ${srcs} ${userApps} ${3RDPARTY_LIBS})
-#target_link_libraries(gsd gsd_core gsd_modules gsd_plugins ${3RDPARTY_LIBS} pthread dl)
+set(EXECUTABLE_OUTPUT_PATH ${TEST_ROOT_DIR}/bin)
 
 add_executable(hepu_test ${tests} ${testApps} ${3RDPARTY_LIBS})
 target_link_libraries(hepu_test gsd_core gsd_modules gsd_plugins ${3RDPARTY_LIBS} pthread dl)

+ 5 - 3
test/TestApp/src/TestApp.cpp

@@ -8,10 +8,12 @@ namespace gsd
 
     bool TestApp::Init(){
         if(this->m_HepuPlugin == nullptr) m_HepuPlugin = HepuPlugin::getPtr();
-        if(this->m_HepuPlugin == nullptr){
-            ErrorL << "Hepuplughin cannot be created" << endl;
+        if(!this->m_HepuPlugin->Init()){
+            ErrorL << "Hepuplugin INIT failed" << endl;
             return false;
         }
+        
+        InfoL << "Hepuplugin INIT success." << endl;
         NoticeCenter::Instance().addListener(0, NOTICE_DESTROY,
             [&](){
             this->Destroy();
@@ -20,7 +22,7 @@ namespace gsd
     }
 
     bool TestApp::StartTask(){
-        InfoL;
+        InfoL << "App start tasks."<<endl;
 
         if(this->timer0 == nullptr){
             this->timer0 = std::make_shared<Timer>(10.0f,[&](){

BIN
test/bin/hepu_test