Skip to content

Commit a9f3821

Browse files
committed
rename echo_client to testee client to better reflect its role
1 parent 2964acd commit a9f3821

File tree

4 files changed

+26
-54
lines changed

4 files changed

+26
-54
lines changed

SConstruct

+6-36
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,21 @@ if not env['PLATFORM'].startswith('win'):
203203
# Main test application
204204
#main = SConscript('#/examples/dev/SConscript',variant_dir = builddir + 'dev',duplicate = 0)
205205

206-
# testee_server
207-
testee_server = SConscript('#/examples/testee_server/SConscript',variant_dir = builddir + 'testee_server',duplicate = 0)
208-
209206
# echo_server
210207
echo_server = SConscript('#/examples/echo_server/SConscript',variant_dir = builddir + 'echo_server',duplicate = 0)
211208

212209
# echo_server_tls
213-
if not env['PLATFORM'].startswith('win'):
210+
if tls_build:
214211
echo_server_tls = SConscript('#/examples/echo_server_tls/SConscript',variant_dir = builddir + 'echo_server_tls',duplicate = 0)
215212

216213
# broadcast_server
217214
broadcast_server = SConscript('#/examples/broadcast_server/SConscript',variant_dir = builddir + 'broadcast_server',duplicate = 0)
218215

219-
# echo_client
220-
echo_client = SConscript('#/examples/echo_client/SConscript',variant_dir = builddir + 'echo_client',duplicate = 0)
216+
# testee_server
217+
testee_server = SConscript('#/examples/testee_server/SConscript',variant_dir = builddir + 'testee_server',duplicate = 0)
218+
219+
# testee_client
220+
testee_client = SConscript('#/examples/testee_client/SConscript',variant_dir = builddir + 'testee_client',duplicate = 0)
221221

222222
# utility_client
223223
utility_client = SConscript('#/examples/utility_client/SConscript',variant_dir = builddir + 'utility_client',duplicate = 0)
@@ -234,33 +234,3 @@ if not env['PLATFORM'].startswith('win'):
234234

235235
# print_server
236236
print_server = SConscript('#/examples/print_server/SConscript',variant_dir = builddir + 'print_server',duplicate = 0)
237-
238-
#
239-
#wsperf = SConscript('#/examples/wsperf/SConscript',
240-
# variant_dir = builddir + 'wsperf',
241-
# duplicate = 0)
242-
243-
#echo_server = SConscript('#/examples/echo_server/SConscript',
244-
# variant_dir = builddir + 'echo_server',
245-
# duplicate = 0)
246-
247-
#if tls_build:
248-
# echo_server_tls = SConscript('#/examples/echo_server_tls/SConscript',
249-
# variant_dir = builddir + 'echo_server_tls',
250-
# duplicate = 0)
251-
252-
#echo_client = SConscript('#/examples/echo_client/SConscript',
253-
# variant_dir = builddir + 'echo_client',
254-
# duplicate = 0)
255-
256-
#chat_client = SConscript('#/examples/chat_client/SConscript',
257-
# variant_dir = builddir + 'chat_client',
258-
# duplicate = 0)
259-
260-
#chat_server = SConscript('#/examples/chat_server/SConscript',
261-
# variant_dir = builddir + 'chat_server',
262-
# duplicate = 0)
263-
264-
#concurrent_server = SConscript('#/examples/concurrent_server/SConscript',
265-
# variant_dir = builddir + 'concurrent_server',
266-
# duplicate = 0)

examples/echo_client/CMakeLists.txt renamed to examples/testee_client/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
file (GLOB SOURCE_FILES *.cpp)
33
file (GLOB HEADER_FILES *.hpp)
44

5-
init_target (echo_client)
5+
init_target (testee_client)
66

77
build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES})
88

examples/echo_client/SConscript renamed to examples/testee_client/SConscript

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Main development example
1+
## Autobahn test client example
22
##
33

44
Import('env')
@@ -15,9 +15,9 @@ prgs = []
1515
# if a C++11 environment is available build using that, otherwise use boost
1616
if env_cpp11.has_key('WSPP_CPP11_ENABLED'):
1717
ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs]
18-
prgs += env_cpp11.Program('echo_client', ["echo_client.cpp"], LIBS = ALL_LIBS)
18+
prgs += env_cpp11.Program('testee_client', ["testee_client.cpp"], LIBS = ALL_LIBS)
1919
else:
2020
ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs]
21-
prgs += env.Program('echo_client', ["echo_client.cpp"], LIBS = ALL_LIBS)
21+
prgs += env.Program('testee_client', ["testee_client.cpp"], LIBS = ALL_LIBS)
2222

2323
Return('prgs')

examples/echo_client/echo_client.cpp renamed to examples/testee_client/testee_client.cpp

+16-14
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) {
1919
client::connection_ptr con = c->get_con_from_hdl(hdl);
2020

2121
if (con->get_resource() == "/getCaseCount") {
22-
std::cout << "Detected " << msg->get_payload() << " test cases." << std::endl;
22+
std::cout << "Detected " << msg->get_payload() << " test cases."
23+
<< std::endl;
2324
case_count = atoi(msg->get_payload().c_str());
2425
} else {
2526
c->send(hdl, msg->get_payload(), msg->get_opcode());
@@ -28,7 +29,7 @@ void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) {
2829

2930
int main(int argc, char* argv[]) {
3031
// Create a server endpoint
31-
client echo_client;
32+
client c;
3233

3334
std::string uri = "ws://localhost:9001";
3435

@@ -38,36 +39,37 @@ int main(int argc, char* argv[]) {
3839

3940
try {
4041
// We expect there to be a lot of errors, so suppress them
41-
echo_client.clear_access_channels(websocketpp::log::alevel::all);
42-
echo_client.clear_error_channels(websocketpp::log::elevel::all);
42+
c.clear_access_channels(websocketpp::log::alevel::all);
43+
c.clear_error_channels(websocketpp::log::elevel::all);
4344

4445
// Initialize ASIO
45-
echo_client.init_asio();
46+
c.init_asio();
4647

4748
// Register our handlers
48-
echo_client.set_message_handler(bind(&on_message,&echo_client,::_1,::_2));
49+
c.set_message_handler(bind(&on_message,&c,::_1,::_2));
4950

5051
websocketpp::lib::error_code ec;
51-
client::connection_ptr con = echo_client.get_connection(uri+"/getCaseCount", ec);
52-
echo_client.connect(con);
52+
client::connection_ptr con = c.get_connection(uri+"/getCaseCount", ec);
53+
c.connect(con);
5354

5455
// Start the ASIO io_service run loop
55-
echo_client.run();
56+
c.run();
5657

5758
std::cout << "case count: " << case_count << std::endl;
5859

5960
for (int i = 1; i <= case_count; i++) {
60-
echo_client.reset();
61+
c.reset();
6162

6263
std::stringstream url;
6364

64-
url << uri << "/runCase?case=" << i << "&agent=" << websocketpp::user_agent;
65+
url << uri << "/runCase?case=" << i << "&agent="
66+
<< websocketpp::user_agent;
6567

66-
con = echo_client.get_connection(url.str(), ec);
68+
con = c.get_connection(url.str(), ec);
6769

68-
echo_client.connect(con);
70+
c.connect(con);
6971

70-
echo_client.run();
72+
c.run();
7173
}
7274

7375
std::cout << "done" << std::endl;

0 commit comments

Comments
 (0)