mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 08:17:13 +00:00
Merge remote branch 'peter/network-streaming' into network-streaming-vcpp2010
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "../../src/websocketpp.hpp"
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -61,28 +62,28 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << "case count: " << c->m_case_count << std::endl;
|
||||
|
||||
for (int i = 1; i <= c->m_case_count; i++) {
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Resetting io_service" << std::endl;
|
||||
io_service.reset();
|
||||
//boost::asio::io_service ios;
|
||||
|
||||
//client.reset();
|
||||
//client = websocketpp::client_ptr(new websocketpp::client(io_service,c));
|
||||
|
||||
std::cout << "foo: " << i << std::endl;
|
||||
//websocketpp::client_ptr client2(new websocketpp::client(io_service,c));
|
||||
|
||||
client->set_alog_level(websocketpp::ALOG_OFF);
|
||||
client->set_elog_level(websocketpp::LOG_OFF);
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Initializing client (constructing socket)" << std::endl;
|
||||
client->init();
|
||||
client->set_header("User Agent","WebSocket++/2011-10-27");
|
||||
|
||||
|
||||
std::stringstream foo;
|
||||
std::stringstream url;
|
||||
|
||||
foo << "ws://localhost:9001/runCase?case=" << i << "&agent=\"WebSocket++Snapshot/2011-10-27\"";
|
||||
url << "ws://localhost:9001/runCase?case=" << i << "&agent=\"WebSocket++Snapshot/2011-10-27\"";
|
||||
|
||||
client->connect(foo.str());
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Parsing URL and resolving DNS" << std::endl;
|
||||
client->connect(url.str());
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Starting io_service for test " << i << std::endl;
|
||||
io_service.run();
|
||||
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " test " << i << " complete" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "done" << std::endl;
|
||||
|
||||
@@ -28,16 +28,17 @@
|
||||
#include "echo_client_handler.hpp"
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
using websocketecho::echo_client_handler;
|
||||
using websocketpp::client_session_ptr;
|
||||
|
||||
void echo_client_handler::on_open(session_ptr s) {
|
||||
std::cout << "Successfully connected: " << s->get_resource() << std::endl;
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " Successfully connected (handshake complete): " << s->get_resource() << std::endl;
|
||||
}
|
||||
|
||||
void echo_client_handler::on_close(session_ptr s) {
|
||||
std::cout << "client was disconnected" << std::endl;
|
||||
std::cout << boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time()) << " client was disconnected (WS state is now CLOSED)" << std::endl;
|
||||
}
|
||||
|
||||
void echo_client_handler::on_message(session_ptr s,const std::string &msg) {
|
||||
|
||||
Reference in New Issue
Block a user