From de058d2a0df3b5de3733b8d71a04e0c017c7c945 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 17 Jun 2019 18:37:34 +0200 Subject: [PATCH] Don't hardcode broadcast port. --- client/TracyProfiler.cpp | 2 +- common/TracySocket.cpp | 4 ++-- common/TracySocket.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 513ca956..cb2a0846 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1152,7 +1152,7 @@ void Profiler::Worker() if( t - m_lastBroadcast > 5000000000 ) // 5s { m_lastBroadcast = t; - m_broadcast->Send( broadcastMsg, broadcastLen ); + m_broadcast->Send( 8087, broadcastMsg, broadcastLen ); auto err = WSAGetLastError(); } } diff --git a/common/TracySocket.cpp b/common/TracySocket.cpp index 2b61e897..18ff3766 100644 --- a/common/TracySocket.cpp +++ b/common/TracySocket.cpp @@ -413,12 +413,12 @@ void UdpBroadcast::Close() m_sock = -1; } -int UdpBroadcast::Send( const void* data, int len ) +int UdpBroadcast::Send( int port, const void* data, int len ) { assert( m_sock != -1 ); struct sockaddr_in addr; addr.sin_family = AF_INET; - addr.sin_port = htons( 8087 ); + addr.sin_port = htons( port ); addr.sin_addr.s_addr = INADDR_BROADCAST; return sendto( m_sock, (const char*)data, len, MSG_NOSIGNAL, (sockaddr*)&addr, sizeof( addr ) ); } diff --git a/common/TracySocket.hpp b/common/TracySocket.hpp index dbd36005..90f6eaeb 100644 --- a/common/TracySocket.hpp +++ b/common/TracySocket.hpp @@ -72,7 +72,7 @@ public: bool Open( const char* addr, const char* port ); void Close(); - int Send( const void* data, int len ); + int Send( int port, const void* data, int len ); UdpBroadcast( const UdpBroadcast& ) = delete; UdpBroadcast( UdpBroadcast&& ) = delete;