Skip to content

Commit f55581a

Browse files
committed
Update to websocketpp 0.8.2
1 parent 506e344 commit f55581a

File tree

6 files changed

+25
-94
lines changed

6 files changed

+25
-94
lines changed

src/lib/update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
COMMIT=0.8.1
3+
COMMIT=0.8.2
44

55
set -e
66

src/lib/websocketpp/transport/asio/connection.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ class connection : public config::socket_type::socket_con_type {
311311
* needed.
312312
*/
313313
timer_ptr set_timer(long duration, timer_handler callback) {
314-
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
315-
lib::ref(*m_io_service),
316-
lib::asio::milliseconds(duration)
314+
timer_ptr new_timer(
315+
new lib::asio::steady_timer(
316+
*m_io_service,
317+
lib::asio::milliseconds(duration))
317318
);
318319

319320
if (config::enable_multithreading) {
@@ -461,8 +462,7 @@ class connection : public config::socket_type::socket_con_type {
461462
m_io_service = io_service;
462463

463464
if (config::enable_multithreading) {
464-
m_strand = lib::make_shared<lib::asio::io_service::strand>(
465-
lib::ref(*io_service));
465+
m_strand.reset(new lib::asio::io_service::strand(*io_service));
466466
}
467467

468468
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,

src/lib/websocketpp/transport/asio/endpoint.hpp

Lines changed: 15 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -45,69 +45,6 @@ namespace ws_websocketpp {
4545
namespace transport {
4646
namespace asio {
4747

48-
/***
49-
* In current versions of libstdc++, the error_constants.h code associated to mingw32
50-
* does not define certain standard enum values for `std::errc`. (In C++11 standard,
51-
* sections 19.5.2, 19.5.3.) Asio uses these for lib::asio::errc when it is compiled
52-
* as a stand-alone library, so because of the libstdc++ defect, code below referring
53-
* to lib::asio::errc::operation_canceled fails to compile on mingw.
54-
*
55-
* This workaround detects the defect using SFINAE and returns 'false' for the check
56-
* if operation_canceled is not defined, instead of failing to compile.
57-
*
58-
* If upstream patches this later by defining those enum values, then the workaround
59-
* will stop having any effect.
60-
*
61-
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68307
62-
*/
63-
namespace _workaround_gcc_libstdcpp_issue_68307_missing_values {
64-
/***
65-
* Same as std::enable_if, but don't want to introduce dependency on <type_traits>
66-
* since that's C++11 only
67-
*/
68-
template<bool B, class T = void>
69-
struct enable_if {};
70-
71-
template<class T>
72-
struct enable_if<true, T> { typedef T type; };
73-
74-
/***
75-
* Metafunction to test "operation_canceled" value
76-
*/
77-
template <typename T, typename ENABLE=void>
78-
struct op_canceled_helper {
79-
template <typename U>
80-
static inline bool is_op_canceled(const U & u) { return false; }
81-
};
82-
83-
template <typename T>
84-
struct op_canceled_helper<T, enable_if<T::operation_canceled == T::operation_canceled, void> > {
85-
template<typename U>
86-
static inline bool is_op_canceled(const U & u) { return u == T::operation_canceled; }
87-
};
88-
89-
/***
90-
* This function is intended to be a drop-in replacement for
91-
* (asio_ec == lib::asio::errc::operation_canceled)
92-
*
93-
* except that if lib::asio::errc::operation_canceled does not exist, it returns false,
94-
* instead of failing to compile.
95-
*
96-
* When using boost and not asio standalone, then lib::asio::errc is a namespace, not an enum class.
97-
* So the template code will fail to compile and we need to block it from being instantiated, with this
98-
* ifdef. When using boost the standard library symbol definitions aren't relevant afaik.
99-
*/
100-
#ifdef ASIO_STANDALONE
101-
static inline bool is_op_canceled(const lib::asio::error_code & asio_ec) {
102-
return op_canceled_helper<lib::asio::errc, void>::is_op_canceled(asio_ec);
103-
}
104-
#else
105-
static inline bool is_op_canceled(const lib::asio::error_code & asio_ec) {
106-
return asio_ec == lib::asio::errc::operation_canceled;
107-
}
108-
#endif
109-
} // namespace _workaround
110-
11148
/// Asio based endpoint transport component
11249
/**
11350
* transport::asio::endpoint implements an endpoint transport component using
@@ -224,7 +161,7 @@ class endpoint : public config::socket_type {
224161
rhs.m_acceptor = NULL;
225162
rhs.m_listen_backlog = lib::asio::socket_base::max_connections;
226163
rhs.m_state = UNINITIALIZED;
227-
164+
228165
// TODO: this needs to be updated
229166
}
230167
return *this;
@@ -258,8 +195,7 @@ class endpoint : public config::socket_type {
258195

259196
m_io_service = ptr;
260197
m_external_io_service = true;
261-
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
262-
lib::ref(*m_io_service));
198+
m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
263199

264200
m_state = READY;
265201
ec = lib::error_code();
@@ -289,7 +225,7 @@ class endpoint : public config::socket_type {
289225
* @param ec Set to indicate what error occurred, if any.
290226
*/
291227
void init_asio(lib::error_code & ec) {
292-
// Use a smart pointer until the call is successful and ownership has
228+
// Use a smart pointer until the call is successful and ownership has
293229
// successfully been taken. Use unique_ptr when available.
294230
// TODO: remove the use of auto_ptr when C++98/03 support is no longer
295231
// necessary.
@@ -311,7 +247,7 @@ class endpoint : public config::socket_type {
311247
* @see init_asio(io_service_ptr ptr)
312248
*/
313249
void init_asio() {
314-
// Use a smart pointer until the call is successful and ownership has
250+
// Use a smart pointer until the call is successful and ownership has
315251
// successfully been taken. Use unique_ptr when available.
316252
// TODO: remove the use of auto_ptr when C++98/03 support is no longer
317253
// necessary.
@@ -442,15 +378,15 @@ class endpoint : public config::socket_type {
442378
lib::asio::io_service & get_io_service() {
443379
return *m_io_service;
444380
}
445-
381+
446382
/// Get local TCP endpoint
447383
/**
448384
* Extracts the local endpoint from the acceptor. This represents the
449385
* address that WebSocket++ is listening on.
450386
*
451387
* Sets a bad_descriptor error if the acceptor is not currently listening
452388
* or otherwise unavailable.
453-
*
389+
*
454390
* @since 0.7.0
455391
*
456392
* @param ec Set to indicate what error occurred, if any.
@@ -489,10 +425,10 @@ class endpoint : public config::socket_type {
489425

490426
m_acceptor->open(ep.protocol(),bec);
491427
if (bec) {ec = clean_up_listen_after_error(bec);return;}
492-
428+
493429
m_acceptor->set_option(lib::asio::socket_base::reuse_address(m_reuse_addr),bec);
494430
if (bec) {ec = clean_up_listen_after_error(bec);return;}
495-
431+
496432
// if a TCP pre-bind handler is present, run it
497433
if (m_tcp_pre_bind_handler) {
498434
ec = m_tcp_pre_bind_handler(m_acceptor);
@@ -501,13 +437,13 @@ class endpoint : public config::socket_type {
501437
return;
502438
}
503439
}
504-
440+
505441
m_acceptor->bind(ep,bec);
506442
if (bec) {ec = clean_up_listen_after_error(bec);return;}
507-
443+
508444
m_acceptor->listen(m_listen_backlog,bec);
509445
if (bec) {ec = clean_up_listen_after_error(bec);return;}
510-
446+
511447
// Success
512448
m_state = LISTENING;
513449
ec = lib::error_code();
@@ -751,9 +687,7 @@ class endpoint : public config::socket_type {
751687
* @since 0.3.0
752688
*/
753689
void start_perpetual() {
754-
m_work = lib::make_shared<lib::asio::io_service::work>(
755-
lib::ref(*m_io_service)
756-
);
690+
m_work.reset(new lib::asio::io_service::work(*m_io_service));
757691
}
758692

759693
/// Clears the endpoint's perpetual flag, allowing it to exit when empty
@@ -891,15 +825,15 @@ class endpoint : public config::socket_type {
891825
m_elog = e;
892826
}
893827

894-
void handle_accept(accept_handler callback, lib::asio::error_code const &
828+
void handle_accept(accept_handler callback, lib::asio::error_code const &
895829
asio_ec)
896830
{
897831
lib::error_code ret_ec;
898832

899833
m_alog->write(log::alevel::devel, "asio::handle_accept");
900834

901835
if (asio_ec) {
902-
if (_workaround_gcc_libstdcpp_issue_68307_missing_values::is_op_canceled(asio_ec)) {
836+
if (asio_ec == lib::asio::errc::operation_canceled) {
903837
ret_ec = make_error_code(ws_websocketpp::error::operation_canceled);
904838
} else {
905839
log_err(log::elevel::info,"asio handle_accept",asio_ec);
@@ -917,8 +851,7 @@ class endpoint : public config::socket_type {
917851

918852
// Create a resolver
919853
if (!m_resolver) {
920-
m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>(
921-
lib::ref(*m_io_service));
854+
m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service));
922855
}
923856

924857
tcon->set_uri(u);

src/lib/websocketpp/transport/asio/security/none.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ class connection : public lib::enable_shared_from_this<connection> {
168168
return socket::make_error_code(socket::error::invalid_state);
169169
}
170170

171-
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
172-
lib::ref(*service));
171+
m_socket.reset(new lib::asio::ip::tcp::socket(*service));
173172

174173
if (m_socket_init_handler) {
175174
m_socket_init_handler(m_hdl, *m_socket);

src/lib/websocketpp/transport/asio/security/tls.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ class connection : public lib::enable_shared_from_this<connection> {
193193
if (!m_context) {
194194
return socket::make_error_code(socket::error::invalid_tls_context);
195195
}
196-
m_socket = lib::make_shared<socket_type>(
197-
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
196+
m_socket.reset(new socket_type(*service, *m_context));
198197

199198
if (m_socket_init_handler) {
200199
m_socket_init_handler(m_hdl, get_socket());

src/lib/websocketpp/version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static int const major_version = 0;
4444
/// Library minor version number
4545
static int const minor_version = 8;
4646
/// Library patch version number
47-
static int const patch_version = 1;
47+
static int const patch_version = 2;
4848
/// Library pre-release flag
4949
/**
5050
* This is a textual flag indicating the type and number for pre-release
@@ -54,7 +54,7 @@ static int const patch_version = 1;
5454
static char const prerelease_flag[] = "";
5555

5656
/// Default user agent string
57-
static char const user_agent[] = "WebSocket++/0.8.1";
57+
static char const user_agent[] = "WebSocket++/0.8.2";
5858

5959
} // namespace ws_websocketpp
6060

0 commit comments

Comments
 (0)