Skip to content

Commit 530af78

Browse files
Fixed issue where two data publishers are listening on the same port - second instance on same port will now throw an exception.
1 parent 4ef1f12 commit 530af78

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/lib/transport/DataPublisher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ void DataPublisher::Start(const TcpEndPoint& endpoint)
851851
m_commandChannelService.restart();
852852
#endif
853853

854-
m_clientAcceptor = TcpAcceptor(m_commandChannelService, endpoint);
854+
m_clientAcceptor = TcpAcceptor(m_commandChannelService, endpoint, false);
855855

856856
// Run call-back thread
857857
m_commandChannelAcceptThread = Thread([&,this]

src/samples/AdvancedPublish/AdvancedPublish.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ int main(int argc, char* argv[])
169169
const bool genHistory = argc > 2 && IsEqual(argv[2], "GenHistory");
170170

171171
// Run the publisher.
172-
if (RunPublisher(port, genHistory))
173-
{
174-
// Wait until the user presses enter before quitting.
175-
string line;
176-
getline(cin, line);
172+
const bool publisherRunning = RunPublisher(port, genHistory);
173+
174+
// Wait until the user presses enter before quitting.
175+
string line;
176+
getline(cin, line);
177177

178-
// Stop data publication
178+
// Stop data publication
179+
if (publisherRunning)
179180
PublishTimer->Stop();
180-
}
181181

182182
if (genHistory)
183183
HistoryGenerator->StopArchive();

0 commit comments

Comments
 (0)