Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/corvusoft/restbed
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-crowhurst committed May 13, 2017
2 parents 35a89ed + 81f844b commit 978c28b
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions source/corvusoft/restbed/detail/socket_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ namespace restbed
void SocketImpl::write( const Bytes& data, const function< void ( const error_code&, size_t ) >& callback )
{
m_buffer = make_shared< Bytes >( data );
if (m_is_open) {

m_timer->cancel( );
m_timer->expires_from_now( m_timeout );
Expand Down Expand Up @@ -207,15 +208,17 @@ namespace restbed
}

#endif
}
}

size_t SocketImpl::read( const shared_ptr< asio::streambuf >& data, const size_t length, error_code& error )
{
size_t size = 0;
if (m_is_open) {
m_timer->cancel( );
m_timer->expires_from_now( m_timeout );
m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, shared_from_this( ), _1 ) );

size_t size = 0;
#ifdef BUILD_SSL

if ( m_socket not_eq nullptr )
Expand All @@ -231,7 +234,7 @@ namespace restbed

#endif
m_timer->cancel( );

}
if ( error )
{
m_is_open = false;
Expand All @@ -242,6 +245,7 @@ namespace restbed

void SocketImpl::read( const std::size_t length, const function< void ( const Bytes ) > success, const function< void ( const error_code ) > failure )
{
if (m_is_open) {
m_timer->cancel( );
m_timer->expires_from_now( m_timeout );
m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, shared_from_this( ), _1 ) );
Expand Down Expand Up @@ -290,10 +294,13 @@ namespace restbed
}

#endif
}
}

void SocketImpl::read( const shared_ptr< asio::streambuf >& data, const size_t length, const function< void ( const error_code&, size_t ) >& callback )
{

if (m_is_open) {
m_timer->cancel( );
m_timer->expires_from_now( m_timeout );
m_timer->async_wait( m_strand->wrap( bind( &SocketImpl::connection_timeout_handler, shared_from_this( ), _1 ) ) );
Expand Down Expand Up @@ -338,15 +345,18 @@ namespace restbed
}

#endif
}
}

size_t SocketImpl::read( const shared_ptr< asio::streambuf >& data, const string& delimiter, error_code& error )
{
size_t length = 0;
if (m_is_open) {
m_timer->cancel( );
m_timer->expires_from_now( m_timeout );
m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, shared_from_this( ), _1 ) );

size_t length = 0;


#ifdef BUILD_SSL

Expand All @@ -363,7 +373,7 @@ namespace restbed

#endif
m_timer->cancel( );

}
if ( error )
{
m_is_open = false;
Expand All @@ -374,6 +384,8 @@ namespace restbed

void SocketImpl::read( const shared_ptr< asio::streambuf >& data, const string& delimiter, const function< void ( const error_code&, size_t ) >& callback )
{

if (m_is_open) {
m_timer->cancel( );
m_timer->expires_from_now( m_timeout );
m_timer->async_wait( m_strand->wrap( bind( &SocketImpl::connection_timeout_handler, shared_from_this( ), _1 ) ) );
Expand Down Expand Up @@ -418,6 +430,7 @@ namespace restbed
}

#endif
}
}

string SocketImpl::get_local_endpoint( void )
Expand Down

0 comments on commit 978c28b

Please sign in to comment.