Unverified Commit 2648501c authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Allow runtime configuration of RPC port

RPC port can now be configured at runtime through `--bind-port` command line argument.
parent 7ea4649f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ struct FsConfig {
    std::unordered_map<std::string, std::string> endpoints;
    uint64_t host_id; // my host number
    size_t host_size;
    std::string rpc_port;
    unsigned int rpc_port;
    std::string lookup_file;
};

+3 −3
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ private:
    std::map<uint64_t, std::string> hosts_;
    uint64_t host_id_; // my host number
    size_t host_size_;
    std::string rpc_port_;
    unsigned int rpc_port_;
    std::string lookup_file_;

    // Database
@@ -129,9 +129,9 @@ public:

    void host_size(size_t host_size);

    std::string rpc_port() const;
    unsigned int rpc_port() const;

    void rpc_port(std::string rpc_port);
    void rpc_port(unsigned int rpc_port);

    const std::string& lookup_file() const;

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
#define DAEMON_IO_XSTREAMS 8
// Number of threads used for RPC handlers at the daemon
#define DAEMON_RPC_HANDLER_XSTREAMS 8
#define RPC_PORT 4433
#define DEFAULT_RPC_PORT 4433
#define RPC_TRIES 3
// rpc timeout to try again in milliseconds
#define RPC_TIMEOUT 180000
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ MERCURY_GEN_PROC(rpc_config_out_t, ((hg_const_string_t) (mountdir))
((hg_const_string_t) (hosts_raw)) \
((hg_uint64_t) (host_id)) \
        ((hg_uint64_t) (host_size)) \
        ((hg_uint64_t) (rpc_port)) \
        ((hg_const_string_t) (lookup_file))
)

+3 −1
Original line number Diff line number Diff line
@@ -70,7 +70,9 @@ bool get_fs_config() {
    CTX->fs_conf()->host_id = out.host_id;
    CTX->fs_conf()->host_size = out.host_size;
    CTX->fs_conf()->lookup_file = out.lookup_file;
    CTX->fs_conf()->rpc_port = std::to_string(RPC_PORT);
    CTX->fs_conf()->rpc_port = out.rpc_port;

    CTX->log()->debug("RPC port: {}", out.rpc_port);

    // split comma separated host string and create a hosts map
    std::string hosts_raw = out.hosts_raw;
Loading