From 2690a52fe534812d5a551ad682aeb7412fc51a28 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Tue, 3 Jun 2014 19:00:22 -0400 Subject: [PATCH] Add a function to return the local endpoint of a http server --- include/fc/network/http/server.hpp | 1 + src/network/http/http_server.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/fc/network/http/server.hpp b/include/fc/network/http/server.hpp index a90764e..b5eda8b 100644 --- a/include/fc/network/http/server.hpp +++ b/include/fc/network/http/server.hpp @@ -46,6 +46,7 @@ namespace fc { namespace http { }; void listen( const fc::ip::endpoint& p ); + fc::ip::endpoint get_local_endpoint() const; /** * Set the callback to be called for every http request made. diff --git a/src/network/http/http_server.cpp b/src/network/http/http_server.cpp index 095ba0c..2ad966a 100644 --- a/src/network/http/http_server.cpp +++ b/src/network/http/http_server.cpp @@ -96,10 +96,15 @@ namespace fc { namespace http { server::~server(){} - void server::listen( const fc::ip::endpoint& p ) { + void server::listen( const fc::ip::endpoint& p ) + { my.reset( new impl(p) ); } + fc::ip::endpoint server::get_local_endpoint() const + { + return my->tcp_serv.get_local_endpoint(); + } server::response::response(){}