From 95e09be799b695dd2eeabb89d25bbd98ed906c62 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Fri, 7 Nov 2014 10:17:27 +0100 Subject: [PATCH] net: add has_per_core_namespace() attribute to network stack POSIX stack does not allow one to bind more than one socket to given port. Native stack on the other hand does. The way services are set up depends on that. For instance, on native stack one might want to start the service on all cores, but on POSIX stack only on one of them. --- core/reactor.hh | 1 + net/native-stack.cc | 1 + net/posix-stack.hh | 1 + 3 files changed, 3 insertions(+) diff --git a/core/reactor.hh b/core/reactor.hh index f6febd5d9a..f9dd92e4c0 100644 --- a/core/reactor.hh +++ b/core/reactor.hh @@ -194,6 +194,7 @@ public: virtual future<> initialize() { return make_ready_future(); } + virtual bool has_per_core_namespace() = 0; }; class network_stack_registry { diff --git a/net/native-stack.cc b/net/native-stack.cc index 1167188c16..633e428d8e 100644 --- a/net/native-stack.cc +++ b/net/native-stack.cc @@ -45,6 +45,7 @@ public: static std::unique_ptr create(boost::program_options::variables_map opts) { return std::make_unique(opts); } + virtual bool has_per_core_namespace() override { return true; }; friend class native_server_socket_impl; }; diff --git a/net/posix-stack.hh b/net/posix-stack.hh index 3f5ea698b6..98c706a5fd 100644 --- a/net/posix-stack.hh +++ b/net/posix-stack.hh @@ -68,6 +68,7 @@ public: static std::unique_ptr create(boost::program_options::variables_map opts) { return std::unique_ptr(new posix_network_stack(opts)); } + virtual bool has_per_core_namespace() override { return false; }; }; class posix_ap_network_stack : public posix_network_stack {