From 5d8156ea4c34f9a3cb986da16a71faebfb2add6b Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 2 Jun 2020 18:52:39 +0200 Subject: [HICN-622] Add stop() functionality to http proxy. Signed-off-by: Mauro Sardara Change-Id: I9091cd8ef0f9da869b886541a0116adf3f30e6b9 Signed-off-by: Angelo Mantellini --- apps/http-proxy/main.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'apps/http-proxy/main.cc') diff --git a/apps/http-proxy/main.cc b/apps/http-proxy/main.cc index 8d407ba4c..d5052ef11 100644 --- a/apps/http-proxy/main.cc +++ b/apps/http-proxy/main.cc @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "src/http_proxy.h" +#include using namespace transport; @@ -41,13 +41,13 @@ struct Params : HTTPProxy::ClientParams, HTTPProxy::ServerParams { << "N Threads: " << n_thread << std::endl; } - HTTPProxy instantiateProxyAsValue() { + HTTPProxy* instantiateProxyAsValue() { if (client) { HTTPProxy::ClientParams* p = dynamic_cast(this); - return transport::HTTPProxy(*p, n_thread); + return new transport::HTTPProxy(*p, n_thread); } else if (server) { HTTPProxy::ServerParams* p = dynamic_cast(this); - return transport::HTTPProxy(*p, n_thread); + return new transport::HTTPProxy(*p, n_thread); } else { throw std::runtime_error( "Proxy configured as client and server at the same time."); @@ -134,8 +134,9 @@ int main(int argc, char** argv) { } params.printParams(); - transport::HTTPProxy proxy = params.instantiateProxyAsValue(); - proxy.run(); + auto proxy = params.instantiateProxyAsValue(); + proxy->run(); + delete proxy; return 0; } \ No newline at end of file -- cgit 1.2.3-korg