Skip to content
Snippets Groups Projects
Commit 1ce26c24 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[*] Build errors fixed

[*] some changes in default configs
[+] sig handler
[+] Some submodules
parent 82d48a93
No related branches found
No related tags found
No related merge requests found
......@@ -30,3 +30,7 @@
path = libdap-server-core
url = https://github.com/kelvinblockchain/libdap-server-core
branch = master
[submodule "libdap-stream-ch-chain"]
path = libdap-stream-ch-chain
url = https://github.com/kelvinblockchain/libdap-stream-ch-chain
branch = master
......@@ -27,10 +27,7 @@ SET( CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/../debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/../debian/postrm;${CMAKE_CURRENT_SOURCE_DIR}/../debian/templates;${CMAKE_CURRENT_SOURCE_DIR}/../debian/config;")
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../dist/ DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*" PATTERN "*")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin FILES_MATCHING PATTERN "*" PATTERN "*" PERMISSIONS OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;WORLD_READ;GROUP_READ )
INCLUDE(CPack)
add_definitions ("-DDAP_SERVER")
add_definitions ("-DNODE_NETNAME=\"kelvin\"")
......@@ -41,6 +38,8 @@ add_subdirectory(libdap-server-core)
add_subdirectory(libdap-server)
add_subdirectory(libdap-chain)
add_subdirectory(libdap-stream)
add_subdirectory(libdap-stream-ch-vpn)
add_subdirectory(libdap-stream-ch-chain)
#include_directories("${INCLUDE_DIRECTORIES} ${dap_core_INCLUDE_DIRS}")
......@@ -74,5 +73,11 @@ set(SOURCES sources/main.c )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ")
add_executable(${PROJECT_NAME} "sources/main.c" ${HEADERS} ${SOURCES} ${SERVER_SRCS} )
target_link_libraries(${PROJECT_NAME} dap_core_server dap_http_server dap_udp_server dap_session dap_crypto dap_core dap_enc_server dap_stream m pthread)
add_executable(${PROJECT_NAME} "sources/main.c" "sources/sig_unix_handler.c"${HEADERS} ${SOURCES} ${SERVER_SRCS} )
target_link_libraries(${PROJECT_NAME} dap_core_server dap_http_server dap_udp_server dap_session dap_crypto dap_core dap_enc_server dap_stream dap_stream_ch_vpn dap_stream_ch_chain m pthread magic)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../dist/ DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*" PATTERN "*")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin FILES_MATCHING PATTERN "*" PATTERN "*" PERMISSIONS OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;WORLD_READ;GROUP_READ )
INCLUDE(CPack)
[general]
name=kelvin
type=development
node-role=full # Possible values: light, full, archive, master, root
default-wallet=node-wallet
[resources]
wallets=/opt/kelvin-node/db/kelvin-dev/wallets
[general]
default-network=kelvin-dev
[network]
listen_address=0.0.0.0
listen_port=8003
[resources]
pid_path=/opt/kelvin-node/run/kelvin-node.pid
log_file=/opt/kelvin-node/log/kelvin-node.log
pid_path=/opt/kelvin-node/var/run/kelvin-node.pid
log_file=/opt/kelvin-node/var/log/kelvin-node.log
[www]
www_root=/opt/dapserver/www
......@@ -13,8 +16,3 @@ main_url_enabled=true
[configure]
TTL_session_key=600
[blockchain]
network-type=testing
wallets=/opt/kelvin-node/var/wallets/
default-wallet=defaul
t
\ No newline at end of file
Subproject commit 65683fd400f116a60b52865c837db2f915ea059a
Subproject commit aa6da6505da33c32dd2990499345cca928301f64
Subproject commit 873516566c5babf018dc672f86064607b8d3d100
Subproject commit 1cbd7f96dc752066f3fe4c50be6735f19331d758
Subproject commit de2ef36999fd50d0c7882975f6634245eab13aac
......@@ -5,6 +5,8 @@
#define LOG_TAG "main"
#include "sig_unix_handler.h"
#include "dap_config.h"
#include "dap_server.h"
#include "dap_http.h"
#include "dap_http_folder.h"
......@@ -12,33 +14,26 @@
#include "dap_enc_ks.h"
#include "dap_enc_http.h"
#ifdef DAP_MOD_SERVER_LIST
#include "mods/serverlist/server_list.h"
#endif
#include "stream_session.h"
#include "stream.h"
#include "stream_ctl.h"
#include "dap_stream_ch_vpn.h"
#include "dap_stream_ch_chain.h"
#include "dap_common.h"
#include "db_http.h"
#include "db_http_file.h"
#include "auth/db_auth.h"
#include "dap_server_client.h"
#include "db_core.h"
#include "dap_http_simple.h"
#include "dap_process_manager.h"
#include "sig_unix_handler.h"
#include "dap_server_config.h"
#include "dap_traffic_track.h"
#define SERVER_FILENAME NODE_NETNAME "-node"
#define SERVER_PREFIX="/opt/"SERVER_FILENAME
#define SERVER_FILENAME NODE_NETNAME"-node"
#define SERVER_PREFIX "/opt/kelvin-node"
#define CONFIG_DIR_PATH SERVER_PREFIX"/etc"
#define GLOBAL_CONFIG_FILENAME SERVER_PREFIX"/etc/"SERVER_FILENAME".cfg"
#define DEFAULT_PID_FILE_PATH SERVER_PREFIX"/run/dapserver.pid"
#define ENC_HTTP_URL "/enc_init"
#define STREAM_URL "/stream_url"
#define STREAM_CTL_URL "/stream_url"
#define SLIST_URL "/nodelist"
#define MAIN_URL "/"
......@@ -52,8 +47,9 @@ int main(int argc, const char * argv[])
dap_server_t * sh; // DAP Server instance
int rc;
if((g_config = dap_server_config_init(CONFIG_DIR_PATH)) == NULL) {
log_it(L_CRITICAL,"Can't init general configurations module");
dap_config_init(CONFIG_DIR_PATH);
if((g_config = dap_config_open(SERVER_FILENAME) ) == NULL) {
log_it(L_CRITICAL,"Can't init general configurations");
return -1;
}
......@@ -142,7 +138,7 @@ int main(int argc, const char * argv[])
dap_config_get_item_int32(g_config, "traffic_track", "callback_timeout");
dap_traffic_track_init(sh, timeout);
dap_traffic_callback_set(db_auth_traffic_track_callback);
// dap_traffic_callback_set(db_auth_traffic_track_callback);
}
// Init HTTP-specific values
......@@ -156,11 +152,8 @@ int main(int argc, const char * argv[])
"www_root",
"/opt/dapserver/www"));
server_list_add_proc(DAP_HTTP(sh), SLIST_URL);
db_http_add_proc(DAP_HTTP(sh), DB_URL);
db_http_file_proc_add(DAP_HTTP(sh), DB_HTTP_FILE_URL);
stream_add_proc_http(DAP_HTTP(sh), STREAM_URL);
stream_ctl_add_proc(DAP_HTTP(sh), CTL_URL);
stream_ctl_add_proc(DAP_HTTP(sh), STREAM_CTL_URL);
enc_http_add_proc(DAP_HTTP(sh), ENC_HTTP_URL);
ch_sf_init(dap_config_get_item_str_default(g_config, "network", "vpn_addr", "10.0.0.0"),
......@@ -174,14 +167,11 @@ int main(int argc, const char * argv[])
// Deinit modules
stream_deinit();
stream_ctl_deinit();
db_http_deinit();
dap_http_folder_deinit();
dap_http_deinit();
dap_server_deinit();
db_core_deinit();
dap_enc_ks_deinit();
dap_common_deinit();
server_list_module_deinit();
return rc*10;
}
}
......
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include "dap_common.h"
#include "sig_unix_handler.h"
static const char *l_pid_path;
static void clear_pid_file() {
FILE * f = fopen(l_pid_path, "w");
if (f == NULL)
log_it(L_WARNING, "Pid file not cleared");
else
fclose(f);
}
_Noreturn static void sig_exit_handler(int sig_code) {
log_it(L_DEBUG, "Got exit code: %d", sig_code);
clear_pid_file();
exit(0);
}
int sig_unix_handler_init(const char *pid_path) {
l_pid_path = strdup(pid_path);
signal(SIGINT, sig_exit_handler);
signal(SIGTERM, sig_exit_handler);
signal(SIGHUP, sig_exit_handler);
return 0;
}
int sig_unix_handler_deinit() {
free((char*)l_pid_path);
signal(SIGTERM, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGHUP, SIG_DFL);
return 0;
}
#pragma once
#undef LOG_TAG
#define LOG_TAG "sig_unix_handler"
extern int sig_unix_handler_init(const char *pid_path);
extern int sig_unix_handler_deinit(void);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment