Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::http::HttpListener Class Reference

Streamable-HTTP front end for an ExternalBridge (gh#204). More...

#include </home/runner/work/entropic/entropic/src/facade/http_listener.h>

Classes

struct  Impl
 httplib state, kept out of the header (no third-party headers). More...
 

Public Member Functions

 HttpListener (ExternalBridge *bridge, int port)
 Bind to 127.0.0.1:port on start(); 0 picks a free port.
 
 ~HttpListener ()
 Stops the server and removes the token file.
 
 HttpListener (const HttpListener &)=delete
 
HttpListener & operator= (const HttpListener &)=delete
 
bool start (std::string &err)
 Write the token, bind, and start serving.
 
void stop ()
 Stop serving and remove the token file.
 
int port () const
 The port actually bound.
 
const std::filesystem::path & token_file () const
 Where this listener's token was written.
 

Detailed Description

Streamable-HTTP front end for an ExternalBridge (gh#204).

Owns the listening socket, the server thread and the token file. Does not own the bridge, which must outlive it.

@dg_internal

Version
2.14.0

Definition at line 172 of file http_listener.h.

Constructor & Destructor Documentation

◆ HttpListener()

entropic::http::HttpListener::HttpListener ( ExternalBridge *  bridge,
int  port 
)

Bind to 127.0.0.1:port on start(); 0 picks a free port.

Parameters
bridgeBridge to dispatch to (not owned).
portPort; 0 = any free port (tests).
Version
2.14.0

Definition at line 399 of file http_listener.cpp.

◆ ~HttpListener()

entropic::http::HttpListener::~HttpListener ( )

Stops the server and removes the token file.

Stop the server and remove the token file.

@req REQ-BRIDGE-001

Version
2.14.0

Definition at line 407 of file http_listener.cpp.

Member Function Documentation

◆ port()

int entropic::http::HttpListener::port ( ) const
inline

The port actually bound.

Returns
Port, or 0 before start().
Version
2.14.0

Definition at line 207 of file http_listener.h.

◆ start()

bool entropic::http::HttpListener::start ( std::string &  err)

Write the token, bind, and start serving.

Parameters
[out]errWhy it could not start.
Returns
true when listening.
Version
2.14.0
Parameters
[out]errWhy it could not start.
Returns
true when listening. @req REQ-BRIDGE-001
Version
2.14.0

Definition at line 482 of file http_listener.cpp.

◆ stop()

void entropic::http::HttpListener::stop ( )

Stop serving and remove the token file.

Idempotent.

Version
2.14.0

Idempotent. @req REQ-BRIDGE-001

Version
2.14.0

Definition at line 534 of file http_listener.cpp.

◆ token_file()

const std::filesystem::path & entropic::http::HttpListener::token_file ( ) const
inline

Where this listener's token was written.

Returns
Token file path (empty before start()).
Version
2.14.0

Definition at line 214 of file http_listener.h.


The documentation for this class was generated from the following files: