Refurbished adcrush (hub stress tester).

This commit is contained in:
Jan Vidar Krey 2012-10-02 23:01:57 +02:00
parent 61073bd304
commit f0b11dadf1
2 changed files with 11 additions and 7 deletions

View File

@ -17,6 +17,7 @@ option(RELEASE "Release build, debug build if disabled" ON)
option(LINK_SUPPORT "Allow hub linking" OFF) option(LINK_SUPPORT "Allow hub linking" OFF)
option(SSL_SUPPORT "Enable SSL support" ON) option(SSL_SUPPORT "Enable SSL support" ON)
option(SQLITE_SUPPORT "Enable SQLite support" ON) option(SQLITE_SUPPORT "Enable SQLite support" ON)
option(ADC_STRESS "Enable the stress tester client" OFF)
find_package(Git) find_package(Git)
@ -137,8 +138,13 @@ target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
if(UNIX) if(UNIX)
add_library(adcclient STATIC ${adcclient_SOURCES}) add_library(adcclient STATIC ${adcclient_SOURCES})
add_executable(uhub-admin ${PROJECT_SOURCE_DIR}/tools/admin.c ${adcclient_SOURCES}) add_executable(uhub-admin ${PROJECT_SOURCE_DIR}/tools/admin.c)
target_link_libraries(uhub-admin adcclient adc network utils) target_link_libraries(uhub-admin adcclient adc network utils)
if (ADC_STRESS)
add_executable(adcrush ${PROJECT_SOURCE_DIR}/tools/adcrush.c ${adcclient_SOURCES})
target_link_libraries(adcrush adcclient adc network utils)
endif()
endif() endif()
if(GIT_FOUND AND IS_DIRECTORY ".git") if(GIT_FOUND AND IS_DIRECTORY ".git")
@ -166,6 +172,7 @@ if (RELEASE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
else() else()
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
add_definitions(-DDEBUG)
endif() endif()

View File

@ -331,13 +331,10 @@ void runloop(size_t clients)
for (n = 0; n < clients; n++) for (n = 0; n < clients; n++)
{ {
struct ADC_client* c = malloc(sizeof(struct ADC_client));
client[n] = c;
char nick[20]; char nick[20];
snprintf(nick, 20, "adcrush_%d", (int) n); snprintf(nick, 20, "adcrush_%d", (int) n);
struct ADC_client* c = ADC_client_create(nick, "stresstester");
ADC_client_create(c, nick, "stresstester"); client[n] = c;
ADC_client_set_callback(c, handle); ADC_client_set_callback(c, handle);
ADC_client_connect(c, cfg_uri); ADC_client_connect(c, cfg_uri);
} }
@ -357,7 +354,7 @@ void runloop(size_t clients)
static void print_version() static void print_version()
{ {
printf(ADCRUSH "\n"); printf(ADCRUSH "\n");
printf("Copyright (C) 2008-2009, Jan Vidar Krey\n"); printf("Copyright (C) 2008-2012, Jan Vidar Krey\n");
printf("\n"); printf("\n");
} }