Commit 39ab2b12 authored by Robert Maynard's avatar Robert Maynard
Browse files

Update the RemusConnection class to work with the latest version of remus.

parent 96a208da
......@@ -122,10 +122,20 @@ bool RemusConnection::connectToServer(const std::string& hostname, int port)
this->m_localServer->startBrokering();
// Connect to the process-local server
this->m_conn = remus::client::ServerConnection();
const remus::server::ServerPorts& ports = this->m_localServer->serverPortInfo();
//The server could have bound to a different port than the one requested.
//This happens when another remus server is active, so ask the server
//for the information on how to connect to it.
this->m_conn = remus::client::make_ServerConnection( ports.client().endpoint() );
//since the server and client are local they can share the same context
this->m_conn.context( ports.context() );
}
else
{
this->m_conn = remus::client::ServerConnection(hostname, port);
}
this->m_client =
smtk::shared_ptr<remus::client::Client>(
new remus::client::Client(this->m_conn));
......
......@@ -23,8 +23,7 @@
#include "remus/client/ServerConnection.h"
#include "remus/server/Server.h"
#include "remus/common/remusGlobals.h"
#include "remus/server/PortNumbers.h"
#include "remus/proto/JobRequirements.h"
......@@ -75,7 +74,7 @@ public:
#ifndef SHIBOKEN_SKIP
bool connectToServer(
const std::string& hostname = "local",
int port = remus::SERVER_CLIENT_PORT);
int port = remus::server::CLIENT_PORT);
#else
// Shiboken cannot parse the default port and does not
// properly handle default arguments anyway, so provide
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment