aboutsummaryrefslogtreecommitdiffstats
path: root/apps/http-proxy/main.cc
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-06-02 18:52:39 +0200
committerAngelo Mantellini <angelo.mantellini@cisco.com>2020-06-03 16:21:49 +0200
commit5d8156ea4c34f9a3cb986da16a71faebfb2add6b (patch)
tree5895f7546c91eab1c6cad917f3a41594a543ca64 /apps/http-proxy/main.cc
parent15458966a342caa0912b7806a755d0d8277ca00f (diff)
[HICN-622] Add stop() functionality to http proxy.
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I9091cd8ef0f9da869b886541a0116adf3f30e6b9 Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com>
Diffstat (limited to 'apps/http-proxy/main.cc')
-rw-r--r--apps/http-proxy/main.cc13
1 files changed, 7 insertions, 6 deletions
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 <hicn/http-proxy/http_proxy.h>
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<HTTPProxy::ClientParams*>(this);
- return transport::HTTPProxy(*p, n_thread);
+ return new transport::HTTPProxy(*p, n_thread);
} else if (server) {
HTTPProxy::ServerParams* p = dynamic_cast<HTTPProxy::ServerParams*>(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