From b7009335fe0591a0cafb29502afcbe928f622d6e Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Thu, 26 Jul 2012 11:27:22 +0100 Subject: [PATCH 1/5] fix usage of C99 macros in C++ --- src/rng/boost_rng.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rng/boost_rng.hpp b/src/rng/boost_rng.hpp index 2513163910..8069937080 100644 --- a/src/rng/boost_rng.hpp +++ b/src/rng/boost_rng.hpp @@ -30,7 +30,9 @@ #ifndef BOOST_RNG_HPP #define BOOST_RNG_HPP +#define __STDC_LIMIT_MACROS 1 #include + #include #include From 159b9d3a886981bb654c08e984d87500b5847968 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Sun, 29 Jul 2012 08:44:42 +0100 Subject: [PATCH 2/5] fix missing boost_thread from some examples --- examples/broadcast_server_tls/Makefile | 2 +- examples/chat_client/Makefile | 2 ++ examples/fuzzing_server_tls/Makefile | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/broadcast_server_tls/Makefile b/examples/broadcast_server_tls/Makefile index 8ab28c4dc5..01804900b9 100644 --- a/examples/broadcast_server_tls/Makefile +++ b/examples/broadcast_server_tls/Makefile @@ -1,4 +1,4 @@ -BOOST_LIBS=boost_system boost_date_time boost_regex +BOOST_LIBS=boost_system boost_date_time boost_regex boost_thread include ../common.mk diff --git a/examples/chat_client/Makefile b/examples/chat_client/Makefile index 6cd68f70b6..a2162bdeab 100644 --- a/examples/chat_client/Makefile +++ b/examples/chat_client/Makefile @@ -2,6 +2,8 @@ BOOST_LIBS=boost_system boost_thread boost_regex boost_random include ../common.mk +LDFLAGS := $(LDFLAGS) -lpthread + chat_client: chat_client.o chat_client_handler.o $(CXX) $(CFLAGS) $^ -o $@ $(LDFLAGS) diff --git a/examples/fuzzing_server_tls/Makefile b/examples/fuzzing_server_tls/Makefile index ec9e841446..761cc10a0f 100644 --- a/examples/fuzzing_server_tls/Makefile +++ b/examples/fuzzing_server_tls/Makefile @@ -1,4 +1,4 @@ -BOOST_LIBS=boost_system boost_date_time boost_regex +BOOST_LIBS=boost_system boost_date_time boost_regex boost_thread include ../common.mk From a0040da1d70a254fc7ffab2862b5326f0b0bea4d Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 31 Jul 2012 09:44:27 +0100 Subject: [PATCH 3/5] add another missing linkage against pthreads --- examples/fuzzing_client/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/fuzzing_client/Makefile b/examples/fuzzing_client/Makefile index f62538d8dd..c757815aeb 100644 --- a/examples/fuzzing_client/Makefile +++ b/examples/fuzzing_client/Makefile @@ -2,6 +2,8 @@ BOOST_LIBS=boost_system boost_date_time boost_thread boost_regex boost_random include ../common.mk +LDFLAGS := $(LDFLAGS) -lpthread + fuzzing_client: fuzzing_client.o $(CXX) $(CFLAGS) $^ -o $@ $(LDFLAGS) From 3ecec05364870fa494b3e6d1290125f2200eb003 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 31 Jul 2012 10:06:00 +0100 Subject: [PATCH 4/5] fix stress_client warning and compile error --- examples/stress_client/stress_client.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/stress_client/stress_client.cpp b/examples/stress_client/stress_client.cpp index 95cf17eb15..1df66f088d 100644 --- a/examples/stress_client/stress_client.cpp +++ b/examples/stress_client/stress_client.cpp @@ -138,8 +138,8 @@ private: m_msg_stats.clear(); } - int m_connections_max; - int m_connections_cur; + unsigned int m_connections_max; + unsigned int m_connections_cur; std::map m_msg_stats; boost::shared_ptr m_timer; }; @@ -150,14 +150,16 @@ int main(int argc, char* argv[]) { int num_connections = 100; int batch_size = 25; int delay_ms = 16; - - if (argc != 5) { - std::cout << "Usage: `echo_client test_url num_connections batch_size delay_ms`" << std::endl; - } else { - uri = argv[1]; - num_connections = atoi(argv[2]); - batch_size = atoi(argv[3]); - delay_ms = atoi(argv[4]); + + if (argc > 1) { + if (argc != 5) { + std::cout << "Usage: `echo_client test_url num_connections batch_size delay_ms`" << std::endl; + } else { + uri = argv[1]; + num_connections = atoi(argv[2]); + batch_size = atoi(argv[3]); + delay_ms = atoi(argv[4]); + } } // 12288 is max OS X limit without changing kernal settings @@ -209,7 +211,7 @@ int main(int argc, char* argv[]) { connections.insert(endpoint.connect(uri)); - boost::thread t(boost::bind(&plain_endpoint_type::run, &endpoint)); + boost::thread t(boost::bind(&plain_endpoint_type::run, &endpoint, false)); std::cout << "launching " << num_connections << " connections to " << uri << " in batches of " << batch_size << std::endl; From 6f0722b04e0753a7a5da88b98ab335d0d0dbcc6a Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 31 Jul 2012 10:39:59 +0100 Subject: [PATCH 5/5] fix build of fuzzing_client this seems fairly fundamental - does nothing else use this and fail? --- src/endpoint.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/endpoint.hpp b/src/endpoint.hpp index 252dff14e3..f9ac5a582b 100644 --- a/src/endpoint.hpp +++ b/src/endpoint.hpp @@ -237,7 +237,7 @@ public: boost::lock_guard lock(m_lock); if (!new_handler) { - elog()->at(log::elevel::FATAL) + elog().at(log::elevel::FATAL) << "Tried to switch to a NULL handler." << log::endl; throw websocketpp::exception("TODO: handlers can't be null"); }