Update HTTP server api to specify network interface
This commit is contained in:
parent
987568e31b
commit
3c59eebe92
2 changed files with 5 additions and 4 deletions
|
|
@ -45,7 +45,7 @@ namespace fc { namespace http {
|
||||||
fc::shared_ptr<impl> my;
|
fc::shared_ptr<impl> my;
|
||||||
};
|
};
|
||||||
|
|
||||||
void listen( uint16_t p );
|
void listen( const fc::ip::endpoint& p );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the callback to be called for every http request made.
|
* Set the callback to be called for every http request made.
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include <fc/thread/thread.hpp>
|
#include <fc/thread/thread.hpp>
|
||||||
#include <fc/network/tcp_socket.hpp>
|
#include <fc/network/tcp_socket.hpp>
|
||||||
#include <fc/io/sstream.hpp>
|
#include <fc/io/sstream.hpp>
|
||||||
|
#include <fc/network/ip.hpp>
|
||||||
#include <fc/io/stdio.hpp>
|
#include <fc/io/stdio.hpp>
|
||||||
#include <fc/log/logger.hpp>
|
#include <fc/log/logger.hpp>
|
||||||
|
|
||||||
|
|
@ -46,7 +47,7 @@ namespace fc { namespace http {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
impl(){}
|
impl(){}
|
||||||
impl(uint16_t p ) {
|
impl(const fc::ip::endpoint& p ) {
|
||||||
tcp_serv.listen(p);
|
tcp_serv.listen(p);
|
||||||
accept_complete = fc::async([this](){ this->accept_loop(); });
|
accept_complete = fc::async([this](){ this->accept_loop(); });
|
||||||
}
|
}
|
||||||
|
|
@ -86,14 +87,14 @@ namespace fc { namespace http {
|
||||||
|
|
||||||
|
|
||||||
server::server(){}
|
server::server(){}
|
||||||
server::server( uint16_t port ) :my( new impl(port) ){}
|
server::server( uint16_t port ) :my( new impl(fc::ip::endpoint( fc::ip::address(),port)) ){}
|
||||||
server::server( server&& s ):my(fc::move(s.my)){}
|
server::server( server&& s ):my(fc::move(s.my)){}
|
||||||
|
|
||||||
server& server::operator=(server&& s) { fc_swap(my,s.my); return *this; }
|
server& server::operator=(server&& s) { fc_swap(my,s.my); return *this; }
|
||||||
|
|
||||||
server::~server(){}
|
server::~server(){}
|
||||||
|
|
||||||
void server::listen( uint16_t p ) {
|
void server::listen( const fc::ip::endpoint& p ) {
|
||||||
my.reset( new impl(p) );
|
my.reset( new impl(p) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue