mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
continues work on program options, updates makefiles for examples
This commit is contained in:
@@ -7,7 +7,7 @@ SHARED ?= "1"
|
||||
ifeq ($(SHARED), 1)
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lwebsocketpp
|
||||
else
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lboost_regex -lboost_random ../../libwebsocketpp.a
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lboost_regex -lboost_random -lboost_program_options ../../libwebsocketpp.a
|
||||
endif
|
||||
|
||||
chat_server: chat_server.o chat.o
|
||||
|
||||
@@ -7,7 +7,7 @@ SHARED ?= "1"
|
||||
ifeq ($(SHARED), 1)
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_thread -lwebsocketpp
|
||||
else
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_thread -lboost_date_time -lboost_regex -lboost_random ../../libwebsocketpp.a
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_thread -lboost_date_time -lboost_regex -lboost_random -lboost_program_options ../../libwebsocketpp.a
|
||||
endif
|
||||
|
||||
echo_client: echo_client.o echo_client_handler.o
|
||||
|
||||
@@ -62,13 +62,11 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << "case count: " << c->m_case_count << std::endl;
|
||||
|
||||
for (int i = 1; i <= c->m_case_count; i++) {
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Resetting io_service" << std::endl;
|
||||
io_service.reset();
|
||||
|
||||
client->set_alog_level(websocketpp::ALOG_OFF);
|
||||
client->set_elog_level(websocketpp::LOG_OFF);
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Initializing client (constructing socket)" << std::endl;
|
||||
client->init();
|
||||
client->set_header("User Agent","WebSocket++/2011-10-27");
|
||||
|
||||
@@ -77,13 +75,9 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
url << "ws://localhost:9001/runCase?case=" << i << "&agent=\"WebSocket++Snapshot/2011-10-27\"";
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Parsing URL and resolving DNS" << std::endl;
|
||||
client->connect(url.str());
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Starting io_service for test " << i << std::endl;
|
||||
io_service.run();
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " test " << i << " complete" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "done" << std::endl;
|
||||
|
||||
@@ -34,11 +34,11 @@ using websocketecho::echo_client_handler;
|
||||
using websocketpp::client_session_ptr;
|
||||
|
||||
void echo_client_handler::on_open(session_ptr s) {
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Successfully connected (handshake complete): " << s->get_resource() << std::endl;
|
||||
std::cout << " Successfully connected (handshake complete): " << s->get_resource() << std::endl;
|
||||
}
|
||||
|
||||
void echo_client_handler::on_close(session_ptr s) {
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " client was disconnected (WS state is now CLOSED)" << std::endl;
|
||||
std::cout << " client was disconnected (WS state is now CLOSED)" << std::endl;
|
||||
}
|
||||
|
||||
void echo_client_handler::on_message(session_ptr s,const std::string &msg) {
|
||||
|
||||
@@ -7,7 +7,7 @@ SHARED ?= "1"
|
||||
ifeq ($(SHARED), 1)
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lwebsocketpp
|
||||
else
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lboost_regex -lboost_random ../../libwebsocketpp.a
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lboost_regex -lboost_random -lboost_program_options ../../libwebsocketpp.a
|
||||
endif
|
||||
|
||||
echo_server: echo_server.o echo.o
|
||||
|
||||
@@ -60,6 +60,10 @@ int main(int argc, char* argv[]) {
|
||||
new websocketpp::server(io_service,endpoint,echo_handler)
|
||||
);
|
||||
|
||||
//server->parse_command_line(argc, argv);
|
||||
|
||||
|
||||
|
||||
// setup server settings
|
||||
//server->set_alog_level(websocketpp::ALOG_OFF);
|
||||
//server->set_elog_level(websocketpp::LOG_OFF);
|
||||
|
||||
@@ -45,10 +45,11 @@ server::server(boost::asio::io_service& io_service,
|
||||
m_io_service(io_service),
|
||||
m_acceptor(io_service, endpoint),
|
||||
m_def_con_handler(defc),
|
||||
m_desc("test") {
|
||||
m_desc.add_options()
|
||||
("help", "produce help message")
|
||||
("intval",po::value<int>(), "set compression level")
|
||||
m_desc("websocketpp::server") {
|
||||
m_desc.add_options()
|
||||
("help", "produce help message")
|
||||
("host,h",po::value<std::vector<std::string> >()->multitoken()->composing(), "hostnames to listen on")
|
||||
("port,p",po::value<int>(), "port to listen on")
|
||||
;
|
||||
|
||||
}
|
||||
@@ -56,6 +57,20 @@ server::server(boost::asio::io_service& io_service,
|
||||
void server::parse_command_line(int ac, char* av[]) {
|
||||
po::store(po::parse_command_line(ac,av, m_desc),m_vm);
|
||||
po::notify(m_vm);
|
||||
|
||||
if (m_vm.count("help") ) {
|
||||
std::cout << m_desc << std::endl;
|
||||
}
|
||||
|
||||
//m_vm["host"].as<std::string>();
|
||||
|
||||
const std::vector< std::string > &foo = m_vm["host"].as< std::vector<std::string> >();
|
||||
|
||||
for (int i = 0; i < foo.size(); i++) {
|
||||
std::cout << foo[i] << std::endl;
|
||||
}
|
||||
|
||||
//std::cout << m_vm["host"].as< std::vector<std::string> >() << std::endl;
|
||||
}
|
||||
|
||||
void server::add_host(std::string host) {
|
||||
|
||||
@@ -120,6 +120,13 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
B6138760145AD09700ED9B19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = examples/echo_server/Makefile; sourceTree = "<group>"; };
|
||||
B6138762145AD0A500ED9B19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = examples/echo_client/Makefile; sourceTree = "<group>"; };
|
||||
B6138763145AD1F700ED9B19 /* chat_client.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = chat_client.html; path = examples/chat_server/chat_client.html; sourceTree = "<group>"; };
|
||||
B6138764145AD1F700ED9B19 /* chat_server.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat_server.cpp; path = examples/chat_server/chat_server.cpp; sourceTree = "<group>"; };
|
||||
B6138765145AD1F700ED9B19 /* chat.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat.cpp; path = examples/chat_server/chat.cpp; sourceTree = "<group>"; };
|
||||
B6138766145AD1F700ED9B19 /* chat.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = chat.hpp; path = examples/chat_server/chat.hpp; sourceTree = "<group>"; };
|
||||
B6138767145AD1F700ED9B19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = examples/chat_server/Makefile; sourceTree = "<group>"; };
|
||||
B6828875143745DA002BA48B /* chat_client_handler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat_client_handler.cpp; path = examples/chat_client/chat_client_handler.cpp; sourceTree = "<group>"; };
|
||||
B6828876143745DA002BA48B /* chat_client_handler.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = chat_client_handler.hpp; path = examples/chat_client/chat_client_handler.hpp; sourceTree = "<group>"; };
|
||||
B6828877143745DA002BA48B /* chat_client.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat_client.cpp; path = examples/chat_client/chat_client.cpp; sourceTree = "<group>"; };
|
||||
@@ -348,6 +355,7 @@
|
||||
B6DF1CCA1435ED760029A1B1 /* echo_server.cpp */,
|
||||
B6DF1CCB1435ED760029A1B1 /* echo.cpp */,
|
||||
B6DF1CCC1435ED760029A1B1 /* echo.hpp */,
|
||||
B6138760145AD09700ED9B19 /* Makefile */,
|
||||
);
|
||||
name = echo_server;
|
||||
sourceTree = "<group>";
|
||||
@@ -358,6 +366,7 @@
|
||||
B6828875143745DA002BA48B /* chat_client_handler.cpp */,
|
||||
B6828876143745DA002BA48B /* chat_client_handler.hpp */,
|
||||
B6828877143745DA002BA48B /* chat_client.cpp */,
|
||||
B6138762145AD0A500ED9B19 /* Makefile */,
|
||||
);
|
||||
name = chat_client;
|
||||
sourceTree = "<group>";
|
||||
@@ -365,6 +374,11 @@
|
||||
B6DF1CC91435ED460029A1B1 /* chat_server */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B6138763145AD1F700ED9B19 /* chat_client.html */,
|
||||
B6138764145AD1F700ED9B19 /* chat_server.cpp */,
|
||||
B6138765145AD1F700ED9B19 /* chat.cpp */,
|
||||
B6138766145AD1F700ED9B19 /* chat.hpp */,
|
||||
B6138767145AD1F700ED9B19 /* Makefile */,
|
||||
);
|
||||
name = chat_server;
|
||||
sourceTree = "<group>";
|
||||
|
||||
Reference in New Issue
Block a user