# # # patch "cmd_netsync.cc" # from [60d61b8d3dfa4bffd394f2bcc70f2970ba41e6c4] # to [5a6b198b12a95e4a0fee8b7edf0e4f8d157fa300] # # patch "netsync.cc" # from [1a7261f49941cb4f55849fe0ba087046b01ee84e] # to [9003b38e8de8bb7b4c179446176cf61d4361ce37] # # patch "network/connection_info.cc" # from [9edab41b536c97a253ea4b55dbe088fb9f09f8c6] # to [f1426c49f3d6d2a8492c444f2555f5de5de75a1d] # # patch "network/connection_info.hh" # from [3575b6cdb9fa29dc15b09b43b969ef4b9c73476e] # to [b1cd70d21e53940d512665deea9db7df53207951] # ============================================================ --- cmd_netsync.cc 60d61b8d3dfa4bffd394f2bcc70f2970ba41e6c4 +++ cmd_netsync.cc 5a6b198b12a95e4a0fee8b7edf0e4f8d157fa300 @@ -191,9 +191,9 @@ build_client_connection_info(options & o if (!db.var_exists(default_server_key) || opts.set_default) { - P(F("setting default server to %s") % info.client.unparsed()); + P(F("setting default server to %s") % info.client.uri.host); db.set_var(default_server_key, - typecast_vocab(info.client.unparsed)); + var_value(info.client.uri.host, origin::user)); } if (!db.var_exists(default_include_pattern_key) || opts.set_default) @@ -317,9 +317,9 @@ CMD_AUTOMATE_NO_STDIO(remote_stdio, if (!db.var_exists(default_server_key) || app.opts.set_default) { - P(F("setting default server to %s") % info.client.unparsed()); + P(F("setting default server to %s") % info.client.uri.host); db.set_var(default_server_key, - typecast_vocab(info.client.unparsed)); + var_value(info.client.uri.host, origin::user)); } info.client.use_argv = @@ -448,9 +448,9 @@ CMD_AUTOMATE_NO_STDIO(remote, if (!db.var_exists(default_server_key) || app.opts.set_default) { - P(F("setting default server to %s") % info.client.unparsed()); + P(F("setting default server to %s") % info.client.uri.host); db.set_var(default_server_key, - typecast_vocab(info.client.unparsed)); + var_value(info.client.uri.host, origin::user)); } info.client.use_argv = ============================================================ --- netsync.cc 1a7261f49941cb4f55849fe0ba087046b01ee84e +++ netsync.cc 9003b38e8de8bb7b4c179446176cf61d4361ce37 @@ -82,11 +82,10 @@ build_stream_to_server(options & opts, l bool use_ipv6=false; #endif string host(info.client.uri.host); - if (host.empty()) - host = info.client.unparsed(); + I(!host.empty()); if (!info.client.uri.port.empty()) default_port = lexical_cast(info.client.uri.port); - Netxx::Address addr(info.client.unparsed().c_str(), + Netxx::Address addr(host.c_str(), default_port, use_ipv6); return shared_ptr (new Netxx::Stream(addr, timeout)); @@ -106,11 +105,11 @@ call_server(app_state & app, Netxx::Timeout timeout(static_cast(constants::netsync_timeout_seconds)), instant(0,1); - P(F("connecting to %s") % info.client.unparsed); + P(F("connecting to %s") % info.client.uri.host); shared_ptr server = build_stream_to_server(app.opts, app.lua, - info, constants::netsync_default_port, + info, info.client.get_port(), timeout); @@ -121,7 +120,7 @@ call_server(app_state & app, shared_ptr sess(new session(app, project, keys, client_voice, - info.client.unparsed(), server)); + info.client.uri.host, server)); shared_ptr wrapped; switch (info.client.connection_type) { @@ -216,10 +215,10 @@ session_from_server_sync_item(app_state try { - P(F("connecting to %s") % info.client.unparsed); + P(F("connecting to %s") % info.client.uri.host); shared_ptr server = build_stream_to_server(app.opts, app.lua, - info, constants::netsync_default_port, + info, info.client.get_port(), Netxx::Timeout(constants::netsync_timeout_seconds)); // 'false' here means not to revert changes when @@ -238,7 +237,7 @@ session_from_server_sync_item(app_state shared_ptr sess(new session(app, project, keys, client_voice, - info.client.unparsed(), server)); + info.client.uri.host, server)); shared_ptr wrapped(new netsync_session(sess.get(), app.opts, app.lua, project, ============================================================ --- network/connection_info.cc 9edab41b536c97a253ea4b55dbe088fb9f09f8c6 +++ network/connection_info.cc f1426c49f3d6d2a8492c444f2555f5de5de75a1d @@ -9,6 +9,7 @@ // PURPOSE. #include "base.hh" +#include "constants.hh" #include "network/connection_info.hh" netsync_connection_info::Client::Client() : @@ -40,6 +41,13 @@ void netsync_connection_info::Client::se output_stream = &os; } +std::size_t netsync_connection_info::Client::get_port() const +{ + if (uri.port.empty()) + return constants::netsync_default_port; + return atoi(uri.port.c_str()); +} + // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- network/connection_info.hh 3575b6cdb9fa29dc15b09b43b969ef4b9c73476e +++ network/connection_info.hh b1cd70d21e53940d512665deea9db7df53207951 @@ -47,6 +47,7 @@ struct netsync_connection_info automate_ostream & get_output_stream() const; void set_input_stream(std::istream & is); void set_output_stream(automate_ostream & os); + std::size_t get_port() const; Client(); } client; };