Commit 9616bd0c authored by Joseph Noir's avatar Joseph Noir

Ensure no servant ID is handed out twice

parent 238cc81f
...@@ -503,7 +503,7 @@ private: ...@@ -503,7 +503,7 @@ private:
std::vector<intrusive_ptr<resumable>> internally_posted_; std::vector<intrusive_ptr<resumable>> internally_posted_;
/// Sequential ids for handles of datagram servants /// Sequential ids for handles of datagram servants
int64_t servant_ids_; std::atomic<int64_t> servant_ids_;
}; };
inline connection_handle conn_hdl_from_socket(native_socket fd) { inline connection_handle conn_hdl_from_socket(native_socket fd) {
......
...@@ -986,7 +986,7 @@ default_multiplexer::new_local_udp_endpoint(uint16_t port, const char* in, ...@@ -986,7 +986,7 @@ default_multiplexer::new_local_udp_endpoint(uint16_t port, const char* in,
} }
int64_t default_multiplexer::next_endpoint_id() { int64_t default_multiplexer::next_endpoint_id() {
return servant_ids_++; return servant_ids_.fetch_add(1);
} }
event_handler::event_handler(default_multiplexer& dm, native_socket sockfd) event_handler::event_handler(default_multiplexer& dm, native_socket sockfd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment