mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[ntcore] Avoid duplicate addition of publishers in server (#7052)
We emitted a warning but went on to do unsafe things. This could cause a delayed crash.
This commit is contained in:
@@ -211,14 +211,14 @@ void ServerImpl::ClientData4Base::ClientPublish(int64_t pubuid,
|
||||
pubuid, std::make_unique<PublisherData>(this, topic, pubuid));
|
||||
if (!isNew) {
|
||||
WARN("client {} duplicate publish of pubuid {}", m_id, pubuid);
|
||||
} else {
|
||||
// add publisher to topic
|
||||
topic->AddPublisher(this, publisherIt->getSecond().get());
|
||||
|
||||
// update meta data
|
||||
m_server.UpdateMetaTopicPub(topic);
|
||||
}
|
||||
|
||||
// add publisher to topic
|
||||
topic->AddPublisher(this, publisherIt->getSecond().get());
|
||||
|
||||
// update meta data
|
||||
m_server.UpdateMetaTopicPub(topic);
|
||||
|
||||
// respond with announce with pubuid to client
|
||||
DEBUG4("client {}: announce {} pubuid {}", m_id, topic->name, pubuid);
|
||||
SendAnnounce(topic, pubuid);
|
||||
|
||||
Reference in New Issue
Block a user