コード例 #1
0
ファイル: RPCHTTPServer.cpp プロジェクト: Aiolossong/rippled
    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";
        }
    }
コード例 #2
0
    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";
        }
    }
コード例 #3
0
ファイル: TestApp.cpp プロジェクト: bdobyns/tinytcp
void MainEntry( void* config )
{
   NetworkThread.Create( NetworkEntry, "Network", 1024, 10, config );

#ifdef _WIN32
   Sleep( 1000 );
#elif __linux__
   usleep( 1000000 );
#endif
   StartEvent.Wait( __FILE__, __LINE__ );

   WebServer.Initialize( 80 );
}
コード例 #4
0
ファイル: RPCHTTPServer.cpp プロジェクト: Aiolossong/rippled
 void onStop (Journal)
 {
     m_server.stopAsync();
 }
コード例 #5
0
ファイル: RPCHTTPServer.cpp プロジェクト: Aiolossong/rippled
 ~RPCHTTPServerImp ()
 {
     m_server.stop();
 }
コード例 #6
0
 void onStop ()
 {
     m_server.stopAsync();
 }
コード例 #7
0
ファイル: RestController.cpp プロジェクト: eile/Tide
RestController::RestController( http::Server& server, DisplayGroup& group )
    : _group( group )
    , _controller( new DisplayGroupController( group ))
{
    server.handlePUT( "tide/deselect-windows", http::PUTFunc{
                      std::bind( &RestController::_deselectWindows, this )});

    server.handlePUT( "tide/exit-fullscreen", http::PUTFunc{
                      std::bind( &RestController::_exitFullScreen, this )});

    server.handlePUT( "tide/focus-windows", http::PUTFunc{
                      std::bind( &RestController::_focusWindows, this )});

    server.handlePUT( "tide/unfocus-windows", http::PUTFunc{
                      std::bind( &RestController::_unfocusWindows, this )});

    server.handlePUT( "tide/move-window-to-front",
                      std::bind( &RestController::_moveWindowToFront, this,
                                 _1 ));

    server.handlePUT( "tide/move-window",
                      std::bind( &RestController::_moveWindow, this, _1 ));

    server.handlePUT( "tide/move-window-to-fullscreen",
                      std::bind( &RestController::_moveWindowToFullscreen, this,
                                 _1 ));

    server.handlePUT( "tide/resize-window",
                      std::bind( &RestController::_resizeWindow, this, _1 ));

    server.handlePUT( "tide/toggle-select-window",
                      std::bind( &RestController::_toggleSelectWindow, this,
                                 _1 ));

    server.handlePUT( "tide/unfocus-window",
                      std::bind( &RestController::_unfocusWindow, this, _1 ));

    server.handle( http::Method::DELETE, "tide/windows/",
                   [this]( const http::Request& request )
    {
        if( auto window = _group.getContentWindow( _toWindowId( request.path )))
        {
            _group.removeContentWindow( window );
            return make_ready_response( http::Code::OK );
        }
        return make_ready_response( http::Code::NO_CONTENT );
    });
}