Make sure we don't subscribe twice to same stream
This commit is contained in:
parent
f159a0eacf
commit
38b9822860
|
@ -33,6 +33,8 @@ namespace streaming {
|
|||
_service.Stop();
|
||||
}
|
||||
|
||||
/// @warning cannot subscribe twice to the same stream (even if it's a
|
||||
/// MultiStream).
|
||||
template <typename Functor>
|
||||
void Subscribe(const Token &token, Functor &&callback) {
|
||||
_client.Subscribe(_service.service(), token, std::forward<Functor>(callback));
|
||||
|
|
|
@ -46,11 +46,14 @@ namespace low_level {
|
|||
}
|
||||
}
|
||||
|
||||
/// @warning cannot subscribe twice to the same stream (even if it's a
|
||||
/// MultiStream).
|
||||
template <typename Functor>
|
||||
void Subscribe(
|
||||
boost::asio::io_service &io_service,
|
||||
token_type token,
|
||||
Functor &&callback) {
|
||||
DEBUG_ASSERT_EQ(_clients.find(token.get_stream_id()), _clients.end());
|
||||
if (!token.has_address()) {
|
||||
token.set_address(_fallback_address);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue