restbed icon indicating copy to clipboard operation
restbed copied to clipboard

Ability to dependency inject network layer.

Open ben-crowhurst opened this issue 10 years ago • 3 comments

Move all ASIO logic into the socket abstraction.

ben-crowhurst avatar Dec 29 '15 07:12 ben-crowhurst

Socket( void );
Socket::listen( port, bind_address, new_connection_callback );
Socket::connect( port, address, success_callback, error_callback );
Socket::write( ..., success_callback, error_callback );
Socket::read( ..., success_callback, error_callback );
Socket::set_option( name, value );
Socket::shutdown( void );
Socket::is_open( void );
Socket::is_closed( void );
static Socket::create( void );
Service::set_network_layer( TCPSocketFactory );
Service::set_network_layer( RS232SocketFactory );
etc...

ben-crowhurst avatar Feb 10 '16 00:02 ben-crowhurst

During this development please remove the io_service and buffer from the request. The Socket should contain all of the ASIO related items.

Given we would have to place all runloop operations in the socket layer after this refactor. Might we want to give it a better name?

Socket::schedule( work );

Maybe:

Runloop runloop;
runloop.schedule( work );

ben-crowhurst avatar Jun 16 '16 04:06 ben-crowhurst

This ticket is rising in priority. With this feature in place we could achieve a far greater set of tests to aid in the validation of the framework logic e.g. confirming WebSocketManager::parse/compose.

ben-crowhurst avatar Nov 03 '16 03:11 ben-crowhurst