Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
zaphoyd committed Nov 4, 2014
2 parents e203dbe + 4100fc3 commit 802e34b
Show file tree
Hide file tree
Showing 141 changed files with 3,042 additions and 1,767 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ examples/wsperf/wsperf_client
*.out

*.log
*.opensdf
*.sdf
*.vcxproj
*.vcxproj.filters
*.user
install
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ branches:
- permessage-deflate
- experimental
- 0.3.x-cmake
- develop
notifications:
recipients:
- travis@zaphoyd.com
Expand Down
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project (websocketpp)
cmake_minimum_required (VERSION 2.6)

set (WEBSOCKETPP_MAJOR_VERSION 0)
set (WEBSOCKETPP_MINOR_VERSION 3)
set (WEBSOCKETPP_MINOR_VERSION 4)
set (WEBSOCKETPP_PATCH_VERSION 0)
set (WEBSOCKETPP_VERSION ${WEBSOCKETPP_MAJOR_VERSION}.${WEBSOCKETPP_MINOR_VERSION}.${WEBSOCKETPP_PATCH_VERSION})

Expand Down Expand Up @@ -87,7 +87,14 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)

# C++11 defines
if (ENABLE_CPP11)
add_definitions (-D_WEBSOCKETPP_CPP11_STL_)
if (MSVC)
add_definitions (-D_WEBSOCKETPP_CPP11_FUNCTIONAL_)
add_definitions (-D_WEBSOCKETPP_CPP11_SYSTEM_ERROR_)
add_definitions (-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_)
add_definitions (-D_WEBSOCKETPP_CPP11_MEMORY_)
else()
add_definitions (-D_WEBSOCKETPP_CPP11_STL_)
endif()
endif ()

# Visual studio
Expand All @@ -106,7 +113,7 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
set (WEBSOCKETPP_PLATFORM_TSL_LIBS ssl crypto)
set (WEBSOCKETPP_BOOST_LIBS system thread)
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++0x")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
if (NOT APPLE)
add_definitions (-DNDEBUG -Wall -Wcast-align) # todo: should we use CMAKE_C_FLAGS for these?
endif ()
Expand Down
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Main Library:

Copyright (c) 2013, Peter Thorson. All rights reserved.
Copyright (c) 2014, Peter Thorson. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PROJECT_NAME = "websocketpp"
# if some version control system is used.


PROJECT_NUMBER = "0.3.0"
PROJECT_NUMBER = "0.4.0"


# Using the PROJECT_BRIEF tag one can provide an optional one line description
Expand Down
12 changes: 7 additions & 5 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ if env['CXX'].startswith('g++'):
#env.Append(CCFLAGS = ['-Wconversion'])
env.Append(CCFLAGS = ['-Wcast-align'])
env.Append(CCFLAGS = ['-Wshadow'])
env.Append(CCFLAGS = ['-Wunused-parameter'])
elif env['CXX'].startswith('clang++'):
#env.Append(CCFLAGS = ['-Wcast-align'])
#env.Append(CCFLAGS = ['-Wglobal-constructors'])
#env.Append(CCFLAGS = ['-Wconversion'])
env.Append(CCFLAGS = ['-Wno-padded'])
env.Append(CCFLAGS = ['-Wshadow'])
env.Append(CCFLAGS = ['-Wunused-parameter'])

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

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

if env_cpp11['CXX'].startswith('g++'):
Expand Down Expand Up @@ -165,18 +167,18 @@ else:
# values then use it for the boost libraries. Otherwise just add them to the
# regular CPPPATH values.
if env['CXX'].startswith('g++') or env['CXX'].startswith('clang'):
env.Append(CPPFLAGS = '-isystem ' + env['BOOST_INCLUDES'])
env.Append(CPPFLAGS = '-isystem ' + env['BOOST_INCLUDES'])
else:
env.Append(CPPPATH = [env['BOOST_INCLUDES']])
env.Append(CPPPATH = [env['BOOST_INCLUDES']])
env.Append(LIBPATH = [env['BOOST_LIBS']])

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

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

0.3.0 - 2014-08-10
- Feature: Adds `start_perpetual` and `stop_perpetual` methods to asio transport
Expand Down
2 changes: 1 addition & 1 deletion docs/simple_broadcast_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class broadcast_server {

void run(uint16_t port) {
m_server.listen(port);
m_server.start_accept();
m_server.start_accept();
m_server.run();
}
private:
Expand Down
2 changes: 1 addition & 1 deletion docs/simple_count_server_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class count_server {

void run(uint16_t port) {
m_server.listen(port);
m_server.start_accept();
m_server.start_accept();
m_server.run();
}
private:
Expand Down
24 changes: 12 additions & 12 deletions examples/broadcast_server/broadcast_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class broadcast_server {
m_server.listen(port);

// Start the server accept loop
m_server.start_accept();
m_server.start_accept();

// Start the ASIO io_service run loop
// Start the ASIO io_service run loop
try {
m_server.run();
} catch (const std::exception & e) {
Expand Down Expand Up @@ -142,18 +142,18 @@ class broadcast_server {
};

int main() {
try {
broadcast_server server_instance;
try {
broadcast_server server_instance;

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

// Run the asio loop with the main thread
server_instance.run(9002);
// Run the asio loop with the main thread
server_instance.run(9002);

t.join();
t.join();

} catch (std::exception & e) {
std::cout << e.what() << std::endl;
}
} catch (std::exception & e) {
std::cout << e.what() << std::endl;
}
}
26 changes: 13 additions & 13 deletions examples/debug_client/debug_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,25 @@ class perftest {
client::connection_ptr con = m_endpoint.get_connection(uri, ec);

if (ec) {
m_endpoint.get_alog().write(websocketpp::log::alevel::app,ec.message());
m_endpoint.get_alog().write(websocketpp::log::alevel::app,ec.message());
}

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

m_endpoint.connect(con);

// Start the ASIO io_service run loop
m_start = std::chrono::high_resolution_clock::now();
// Start the ASIO io_service run loop
m_start = std::chrono::high_resolution_clock::now();
m_endpoint.run();
}

void on_socket_init(websocketpp::connection_hdl hdl) {
void on_socket_init(websocketpp::connection_hdl) {
m_socket_init = std::chrono::high_resolution_clock::now();
}

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

try {
ctx->set_options(boost::asio::ssl::context::default_workarounds |
Expand All @@ -108,11 +108,11 @@ class perftest {
m_open = std::chrono::high_resolution_clock::now();
m_endpoint.send(hdl, "", websocketpp::frame::opcode::text);
}
void on_message(websocketpp::connection_hdl hdl, message_ptr msg) {
void on_message(websocketpp::connection_hdl hdl, message_ptr) {
m_message = std::chrono::high_resolution_clock::now();
m_endpoint.close(hdl,websocketpp::close::status::going_away,"");
}
void on_close(websocketpp::connection_hdl hdl) {
void on_close(websocketpp::connection_hdl) {
m_close = std::chrono::high_resolution_clock::now();

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

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

if (argc == 2) {
uri = argv[1];
}
if (argc == 2) {
uri = argv[1];
}

try {
try {
perftest endpoint;
endpoint.start(uri);
} catch (const std::exception & e) {
Expand Down
6 changes: 3 additions & 3 deletions examples/debug_server/debug_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
}

int main() {
// Create a server endpoint
// Create a server endpoint
server echo_server;

try {
try {
// Set logging settings
echo_server.set_access_channels(websocketpp::log::alevel::all);
echo_server.clear_access_channels(websocketpp::log::alevel::frame_payload);
Expand All @@ -80,7 +80,7 @@ int main() {
// Start the server accept loop
echo_server.start_accept();

// Start the ASIO io_service run loop
// Start the ASIO io_service run loop
echo_server.run();
} catch (const std::exception & e) {
std::cout << e.what() << std::endl;
Expand Down
Loading

0 comments on commit 802e34b

Please sign in to comment.