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.
This commit is contained in:
Tomasz Grabiec
2014-11-07 10:17:27 +01:00
committed by Avi Kivity
parent b647bb5746
commit 95e09be799
3 changed files with 3 additions and 0 deletions

View File

@@ -194,6 +194,7 @@ public:
virtual future<> initialize() {
return make_ready_future();
}
virtual bool has_per_core_namespace() = 0;
};
class network_stack_registry {

View File

@@ -45,6 +45,7 @@ public:
static std::unique_ptr<network_stack> create(boost::program_options::variables_map opts) {
return std::make_unique<native_network_stack>(opts);
}
virtual bool has_per_core_namespace() override { return true; };
friend class native_server_socket_impl<tcp4>;
};

View File

@@ -68,6 +68,7 @@ public:
static std::unique_ptr<network_stack> create(boost::program_options::variables_map opts) {
return std::unique_ptr<network_stack>(new posix_network_stack(opts));
}
virtual bool has_per_core_namespace() override { return false; };
};
class posix_ap_network_stack : public posix_network_stack {