Example #1
0
    void setup (Journal journal)
    {
        if (! getConfig ().getRpcIP().empty () &&
              getConfig ().getRpcPort() != 0)
        {
            IPEndpoint ep (IPEndpoint::from_string (getConfig().getRpcIP()));
            if (! ep.empty())
            {
                HTTP::Port port;
                port.addr = ep.withPort(0);
                if (getConfig ().getRpcPort() != 0)
                    port.port = getConfig ().getRpcPort();
                else
                    port.port = ep.port();
                port.context = m_context;

                HTTP::Ports ports;
                ports.push_back (port);
                m_server.setPorts (ports);
            }
        }
        else
        {
            journal.info << "RPC interface: disabled";
        }
    }
void
ServerHandlerImp::setup (beast::Journal journal)
{
    if (! setup_.ip.empty() && setup_.port != 0)
    {
        auto ep = beast::IP::Endpoint::from_string (setup_.ip);

        // VFALCO TODO IP address should not have an "unspecified" state
        //if (! is_unspecified (ep))
        {
            HTTP::Port port;

            if (setup_.secure == 0)
                port.security = HTTP::Port::Security::no_ssl;
            else if (setup_.secure == 1)
                port.security = HTTP::Port::Security::allow_ssl;
            else
                port.security = HTTP::Port::Security::require_ssl;
            port.addr = ep.at_port(0);
            if (setup_.port != 0)
                port.port = setup_.port;
            else
                port.port = ep.port();
            port.context = m_context.get ();

            HTTP::Ports ports;
            ports.push_back (port);
            m_server.setPorts (ports);
        }
    }
    else
    {
        journal.info << "RPC interface: disabled";
    }
}
    void setup (beast::Journal journal)
    {
        if (! getConfig ().getRpcIP().empty () &&
              getConfig ().getRpcPort() != 0)
        {
            beast::IP::Endpoint ep (beast::IP::Endpoint::from_string (getConfig().getRpcIP()));
            if (! is_unspecified (ep))
            {
                HTTP::Port port;
                port.addr = ep.at_port(0);
                if (getConfig ().getRpcPort() != 0)
                    port.port = getConfig ().getRpcPort();
                else
                    port.port = ep.port();
                port.context = m_context.get ();

                HTTP::Ports ports;
                ports.push_back (port);
                m_server.setPorts (ports);
            }
        }
        else
        {
            journal.info << "RPC interface: disabled";
        }
    }