Compare commits

..

1 Commits

Author SHA1 Message Date
Juan Eugenio Abadie 2a885d5cc4 Remove duplicated word 2018-08-23 00:22:11 -03:00
7 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ If you handle errors from methods like send, ping, close, etc correctly then you
Normally, for security purposes, operating systems prevent programs from listening on sockets created by other programs. When your program crashes and restarts, the new instance is a different program from the perspective of the operating system. As such it cant listen on the socket address/port that the previous program was using until after a timeout occurs to make sure the old program was done with it.
The the first step for handling this is to make sure that you provide a method (signal handler, admin websocket message, etc) to perform a clean server shutdown. There is a question elsewhere in this FAQ that describes the steps necessary for this.
The first step for handling this is to make sure that you provide a method (signal handler, admin websocket message, etc) to perform a clean server shutdown. There is a question elsewhere in this FAQ that describes the steps necessary for this.
The clean close strategy won't help in the case of crashes or other abnormal closures. An option to consider for these cases is the use of the SO_REUSEADDR socket option. This instructs the OS to not request an exclusive lock on the socket. This means that after your program crashes the replacement you start can immediately listen on that address/port combo again.
+3 -3
View File
@@ -2177,7 +2177,7 @@ connection<config>::get_processor(int version) const {
transport_con_type::is_secure(),
m_is_server,
m_msg_manager,
m_rng
lib::ref(m_rng)
);
break;
case 8:
@@ -2185,7 +2185,7 @@ connection<config>::get_processor(int version) const {
transport_con_type::is_secure(),
m_is_server,
m_msg_manager,
m_rng
lib::ref(m_rng)
);
break;
case 13:
@@ -2193,7 +2193,7 @@ connection<config>::get_processor(int version) const {
transport_con_type::is_secure(),
m_is_server,
m_msg_manager,
m_rng
lib::ref(m_rng)
);
break;
default:
+1 -1
View File
@@ -45,7 +45,7 @@ endpoint<connection,config>::create_connection() {
//scoped_lock_type guard(m_mutex);
// Create a connection on the heap and manage it using a shared pointer
connection_ptr con = lib::make_shared<connection_type>(m_is_server,
m_user_agent, m_alog, m_elog, m_rng);
m_user_agent, m_alog, m_elog, lib::ref(m_rng));
connection_weak_ptr w(con);
+2 -2
View File
@@ -312,7 +312,7 @@ public:
*/
timer_ptr set_timer(long duration, timer_handler callback) {
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
*m_io_service,
lib::ref(*m_io_service),
lib::asio::milliseconds(duration)
);
@@ -462,7 +462,7 @@ protected:
if (config::enable_multithreading) {
m_strand = lib::make_shared<lib::asio::io_service::strand>(
*io_service);
lib::ref(*io_service));
}
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,
+3 -3
View File
@@ -196,7 +196,7 @@ public:
m_io_service = ptr;
m_external_io_service = true;
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
*m_io_service);
lib::ref(*m_io_service));
m_state = READY;
ec = lib::error_code();
@@ -689,7 +689,7 @@ public:
*/
void start_perpetual() {
m_work = lib::make_shared<lib::asio::io_service::work>(
*m_io_service
lib::ref(*m_io_service)
);
}
@@ -855,7 +855,7 @@ protected:
// Create a resolver
if (!m_resolver) {
m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>(
*m_io_service);
lib::ref(*m_io_service));
}
tcon->set_uri(u);
+1 -1
View File
@@ -169,7 +169,7 @@ protected:
}
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
*service);
lib::ref(*service));
if (m_socket_init_handler) {
m_socket_init_handler(m_hdl, *m_socket);
+1 -1
View File
@@ -194,7 +194,7 @@ protected:
return socket::make_error_code(socket::error::invalid_tls_context);
}
m_socket = lib::make_shared<socket_type>(
_WEBSOCKETPP_REF(*service),*m_context);
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
if (m_socket_init_handler) {
m_socket_init_handler(m_hdl, get_socket());