Skip to content

Commit 802e34b

Browse files
committed
Merge branch 'develop'
2 parents e203dbe + 4100fc3 commit 802e34b

File tree

141 files changed

+3042
-1767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+3042
-1767
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,9 @@ examples/wsperf/wsperf_client
7878
*.out
7979

8080
*.log
81+
*.opensdf
82+
*.sdf
83+
*.vcxproj
84+
*.vcxproj.filters
85+
*.user
86+
install

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ branches:
1414
- permessage-deflate
1515
- experimental
1616
- 0.3.x-cmake
17+
- develop
1718
notifications:
1819
recipients:
1920
- travis@zaphoyd.com

CMakeLists.txt

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ project (websocketpp)
99
cmake_minimum_required (VERSION 2.6)
1010

1111
set (WEBSOCKETPP_MAJOR_VERSION 0)
12-
set (WEBSOCKETPP_MINOR_VERSION 3)
12+
set (WEBSOCKETPP_MINOR_VERSION 4)
1313
set (WEBSOCKETPP_PATCH_VERSION 0)
1414
set (WEBSOCKETPP_VERSION ${WEBSOCKETPP_MAJOR_VERSION}.${WEBSOCKETPP_MINOR_VERSION}.${WEBSOCKETPP_PATCH_VERSION})
1515

@@ -87,7 +87,14 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
8787

8888
# C++11 defines
8989
if (ENABLE_CPP11)
90-
add_definitions (-D_WEBSOCKETPP_CPP11_STL_)
90+
if (MSVC)
91+
add_definitions (-D_WEBSOCKETPP_CPP11_FUNCTIONAL_)
92+
add_definitions (-D_WEBSOCKETPP_CPP11_SYSTEM_ERROR_)
93+
add_definitions (-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_)
94+
add_definitions (-D_WEBSOCKETPP_CPP11_MEMORY_)
95+
else()
96+
add_definitions (-D_WEBSOCKETPP_CPP11_STL_)
97+
endif()
9198
endif ()
9299

93100
# Visual studio
@@ -106,7 +113,7 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
106113
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
107114
set (WEBSOCKETPP_PLATFORM_TSL_LIBS ssl crypto)
108115
set (WEBSOCKETPP_BOOST_LIBS system thread)
109-
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++0x")
116+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
110117
if (NOT APPLE)
111118
add_definitions (-DNDEBUG -Wall -Wcast-align) # todo: should we use CMAKE_C_FLAGS for these?
112119
endif ()

COPYING

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Main Library:
22

3-
Copyright (c) 2013, Peter Thorson. All rights reserved.
3+
Copyright (c) 2014, Peter Thorson. All rights reserved.
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

Doxyfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PROJECT_NAME = "websocketpp"
3333
# if some version control system is used.
3434

3535

36-
PROJECT_NUMBER = "0.3.0"
36+
PROJECT_NUMBER = "0.4.0"
3737

3838

3939
# Using the PROJECT_BRIEF tag one can provide an optional one line description

SConstruct

+7-5
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ if env['CXX'].startswith('g++'):
101101
#env.Append(CCFLAGS = ['-Wconversion'])
102102
env.Append(CCFLAGS = ['-Wcast-align'])
103103
env.Append(CCFLAGS = ['-Wshadow'])
104+
env.Append(CCFLAGS = ['-Wunused-parameter'])
104105
elif env['CXX'].startswith('clang++'):
105106
#env.Append(CCFLAGS = ['-Wcast-align'])
106107
#env.Append(CCFLAGS = ['-Wglobal-constructors'])
107108
#env.Append(CCFLAGS = ['-Wconversion'])
108109
env.Append(CCFLAGS = ['-Wno-padded'])
109110
env.Append(CCFLAGS = ['-Wshadow'])
111+
env.Append(CCFLAGS = ['-Wunused-parameter'])
110112

111113
# Wpadded
112114
# Wsign-conversion
@@ -132,7 +134,7 @@ env.Append(CPPPATH = ['#'])
132134

133135
##### Set up C++11 environment
134136
polyfill_libs = [] # boost libraries used as drop in replacements for incomplete
135-
# C++11 STL implementations
137+
# C++11 STL implementations
136138
env_cpp11 = env.Clone ()
137139

138140
if env_cpp11['CXX'].startswith('g++'):
@@ -165,18 +167,18 @@ else:
165167
# values then use it for the boost libraries. Otherwise just add them to the
166168
# regular CPPPATH values.
167169
if env['CXX'].startswith('g++') or env['CXX'].startswith('clang'):
168-
env.Append(CPPFLAGS = '-isystem ' + env['BOOST_INCLUDES'])
170+
env.Append(CPPFLAGS = '-isystem ' + env['BOOST_INCLUDES'])
169171
else:
170-
env.Append(CPPPATH = [env['BOOST_INCLUDES']])
172+
env.Append(CPPPATH = [env['BOOST_INCLUDES']])
171173
env.Append(LIBPATH = [env['BOOST_LIBS']])
172174

173175
# if the build system is known to allow the isystem modifier for library include
174176
# values then use it for the boost libraries. Otherwise just add them to the
175177
# regular CPPPATH values.
176178
if env_cpp11['CXX'].startswith('g++') or env_cpp11['CXX'].startswith('clang'):
177-
env_cpp11.Append(CPPFLAGS = '-isystem ' + env_cpp11['BOOST_INCLUDES'])
179+
env_cpp11.Append(CPPFLAGS = '-isystem ' + env_cpp11['BOOST_INCLUDES'])
178180
else:
179-
env_cpp11.Append(CPPPATH = [env_cpp11['BOOST_INCLUDES']])
181+
env_cpp11.Append(CPPPATH = [env_cpp11['BOOST_INCLUDES']])
180182
env_cpp11.Append(LIBPATH = [env_cpp11['BOOST_LIBS']])
181183

182184
releasedir = 'build/release/'

changelog.md

+45-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
1-
HEAD
1+
0.4.0 - 2014-11-04
2+
- BREAKING API CHANGE: All WebSocket++ methods now throw an exception of type
3+
`websocketpp::exception` which derives from `std::exception`. This normalizes
4+
all exception types under the standard exception hierarchy and allows
5+
WebSocket++ exceptions to be caught in the same statement as others. The error
6+
code that was previously thrown is wrapped in the exception object and can be
7+
accessed via the `websocketpp::exception::code()` method.
8+
- BREAKING API CHANGE: Custom logging policies have some new required
9+
constructors that take generic config settings rather than pointers to
10+
std::ostreams. This allows writing logging policies that do not involve the
11+
use of std::ostream. This does not affect anyone using the built in logging
12+
policies.
13+
- BREAKING UTILITY CHANGE: `websocketpp::lib::net::htonll` and
14+
`websocketpp::lib::net::ntohll` have been prefixed with an underscore to avoid
15+
conflicts with similarly named macros in some operating systems. If you are
16+
using the WebSocket++ provided 64 bit host/network byte order functions you
17+
will need to switch to the prefixed versions.
18+
- BREAKING UTILITY CHANGE: The signature of `base64_encode` has changed from
19+
`websocketpp::base64_encode(unsigned char const *, unsigned int)` to
20+
`websocketpp::base64_encode(unsigned char const *, size_t)`.
21+
- BREAKING UTILITY CHANGE: The signature of `sha1::calc` has changed from
22+
`websocketpp::sha1::calc(void const *, int, unsigned char *)` to
23+
`websocketpp::sha1::calc(void const *, size_t, unsigned char *)`
24+
- Feature: Adds incomplete `minimal_server` and `minimal_client` configs that
25+
can be used to build custom configs without pulling in the dependencies of
26+
`core` or `core_client`. These configs will offer a stable base config to
27+
future-proof custom configs.
28+
- Improvement: Core library no longer has std::iostream as a dependency.
29+
std::iostream is still required for the optional iostream logging policy and
30+
iostream transport.
31+
- Bug: C++11 Chrono support was being incorrectly detected by the `boost_config`
32+
header. Thank you Max Dmitrichenko for reporting and a patch.
33+
- Bug: use of `std::put_time` is now guarded by a unique flag rather than a
34+
chrono library flag. Thank you Max Dmitrichenko for reporting.
35+
- Bug: Fixes non-thread safe use of std::localtime. #347 #383
36+
- Compatibility: Adjust usage of std::min to be more compatible with systems
37+
that define a min(...) macro.
38+
- Compatibility: Removes unused parameters from all library, test, and example
39+
code. This assists with those developing with -Werror and -Wunused-parameter
40+
#376
41+
- Compatibility: Renames ntohll and htonll methods to avoid conflicts with
42+
platform specific macros. #358 #381, #382 Thank you logotype, unphased,
43+
svendjo
44+
- Cleanup: Removes unused functions, fixes variable shadow warnings, normalizes
45+
all whitespace in library, examples, and tests to 4 spaces. #376
246

347
0.3.0 - 2014-08-10
448
- Feature: Adds `start_perpetual` and `stop_perpetual` methods to asio transport

docs/simple_broadcast_server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class broadcast_server {
3636

3737
void run(uint16_t port) {
3838
m_server.listen(port);
39-
m_server.start_accept();
39+
m_server.start_accept();
4040
m_server.run();
4141
}
4242
private:

docs/simple_count_server_thread.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class count_server {
4646

4747
void run(uint16_t port) {
4848
m_server.listen(port);
49-
m_server.start_accept();
49+
m_server.start_accept();
5050
m_server.run();
5151
}
5252
private:

examples/broadcast_server/broadcast_server.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class broadcast_server {
5959
m_server.listen(port);
6060

6161
// Start the server accept loop
62-
m_server.start_accept();
62+
m_server.start_accept();
6363

64-
// Start the ASIO io_service run loop
64+
// Start the ASIO io_service run loop
6565
try {
6666
m_server.run();
6767
} catch (const std::exception & e) {
@@ -142,18 +142,18 @@ class broadcast_server {
142142
};
143143

144144
int main() {
145-
try {
146-
broadcast_server server_instance;
145+
try {
146+
broadcast_server server_instance;
147147

148-
// Start a thread to run the processing loop
149-
thread t(bind(&broadcast_server::process_messages,&server_instance));
148+
// Start a thread to run the processing loop
149+
thread t(bind(&broadcast_server::process_messages,&server_instance));
150150

151-
// Run the asio loop with the main thread
152-
server_instance.run(9002);
151+
// Run the asio loop with the main thread
152+
server_instance.run(9002);
153153

154-
t.join();
154+
t.join();
155155

156-
} catch (std::exception & e) {
157-
std::cout << e.what() << std::endl;
158-
}
156+
} catch (std::exception & e) {
157+
std::cout << e.what() << std::endl;
158+
}
159159
}

examples/debug_client/debug_client.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,25 @@ class perftest {
7474
client::connection_ptr con = m_endpoint.get_connection(uri, ec);
7575

7676
if (ec) {
77-
m_endpoint.get_alog().write(websocketpp::log::alevel::app,ec.message());
77+
m_endpoint.get_alog().write(websocketpp::log::alevel::app,ec.message());
7878
}
7979

8080
//con->set_proxy("http://humupdates.uchicago.edu:8443");
8181

8282
m_endpoint.connect(con);
8383

84-
// Start the ASIO io_service run loop
85-
m_start = std::chrono::high_resolution_clock::now();
84+
// Start the ASIO io_service run loop
85+
m_start = std::chrono::high_resolution_clock::now();
8686
m_endpoint.run();
8787
}
8888

89-
void on_socket_init(websocketpp::connection_hdl hdl) {
89+
void on_socket_init(websocketpp::connection_hdl) {
9090
m_socket_init = std::chrono::high_resolution_clock::now();
9191
}
9292

93-
context_ptr on_tls_init(websocketpp::connection_hdl hdl) {
93+
context_ptr on_tls_init(websocketpp::connection_hdl) {
9494
m_tls_init = std::chrono::high_resolution_clock::now();
95-
context_ptr ctx(new boost::asio::ssl::context(boost::asio::ssl::context::tlsv1));
95+
context_ptr ctx = websocketpp::lib::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::tlsv1);
9696

9797
try {
9898
ctx->set_options(boost::asio::ssl::context::default_workarounds |
@@ -108,11 +108,11 @@ class perftest {
108108
m_open = std::chrono::high_resolution_clock::now();
109109
m_endpoint.send(hdl, "", websocketpp::frame::opcode::text);
110110
}
111-
void on_message(websocketpp::connection_hdl hdl, message_ptr msg) {
111+
void on_message(websocketpp::connection_hdl hdl, message_ptr) {
112112
m_message = std::chrono::high_resolution_clock::now();
113113
m_endpoint.close(hdl,websocketpp::close::status::going_away,"");
114114
}
115-
void on_close(websocketpp::connection_hdl hdl) {
115+
void on_close(websocketpp::connection_hdl) {
116116
m_close = std::chrono::high_resolution_clock::now();
117117

118118
std::cout << "Socket Init: " << std::chrono::duration_cast<dur_type>(m_socket_init-m_start).count() << std::endl;
@@ -133,13 +133,13 @@ class perftest {
133133
};
134134

135135
int main(int argc, char* argv[]) {
136-
std::string uri = "wss://echo.websocket.org";
136+
std::string uri = "wss://echo.websocket.org";
137137

138-
if (argc == 2) {
139-
uri = argv[1];
140-
}
138+
if (argc == 2) {
139+
uri = argv[1];
140+
}
141141

142-
try {
142+
try {
143143
perftest endpoint;
144144
endpoint.start(uri);
145145
} catch (const std::exception & e) {

examples/debug_server/debug_server.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
5959
}
6060

6161
int main() {
62-
// Create a server endpoint
62+
// Create a server endpoint
6363
server echo_server;
6464

65-
try {
65+
try {
6666
// Set logging settings
6767
echo_server.set_access_channels(websocketpp::log::alevel::all);
6868
echo_server.clear_access_channels(websocketpp::log::alevel::frame_payload);
@@ -80,7 +80,7 @@ int main() {
8080
// Start the server accept loop
8181
echo_server.start_accept();
8282

83-
// Start the ASIO io_service run loop
83+
// Start the ASIO io_service run loop
8484
echo_server.run();
8585
} catch (const std::exception & e) {
8686
std::cout << e.what() << std::endl;

0 commit comments

Comments
 (0)