rpc_session::rpc_session( connection_oriented_network& net, ::dsn::rpc_address remote_addr, message_parser_ptr& parser, bool is_client ) : _net(net), _remote_addr(remote_addr), _max_buffer_block_count_per_send(net.max_buffer_block_count_per_send()), _reader(net.message_buffer_block_size()), _parser(parser), _is_client(is_client), _matcher(_net.engine()->matcher()), _is_sending_next(false), _message_count(0), _connect_state(is_client ? SS_DISCONNECTED : SS_CONNECTED), _message_sent(0), _delay_server_receive_ms(0) { if (!is_client) { on_rpc_session_connected.execute(this); } }
rpc_session::rpc_session( connection_oriented_network& net, ::dsn::rpc_address remote_addr, std::unique_ptr<message_parser>&& parser, bool is_client ) : _net(net), _remote_addr(remote_addr), _max_buffer_block_count_per_send(net.max_buffer_block_count_per_send()), _parser(std::move(parser)), _is_client(is_client), _matcher(_net.engine()->matcher()), _message_count(0), _is_sending_next(false), _connect_state(is_client ? SS_DISCONNECTED : SS_CONNECTED), _message_sent(0), _delay_server_receive_ms(0) { }