mirror of
https://github.com/wolfpld/tracy
synced 2025-05-03 14:03:52 +00:00
Receive up-to-date tracy version.
This commit is contained in:
parent
e2d69e7981
commit
f5073e628d
@ -37,6 +37,7 @@
|
|||||||
#include "../../server/TracyMouse.hpp"
|
#include "../../server/TracyMouse.hpp"
|
||||||
#include "../../server/TracyPrint.hpp"
|
#include "../../server/TracyPrint.hpp"
|
||||||
#include "../../server/TracyStorage.hpp"
|
#include "../../server/TracyStorage.hpp"
|
||||||
|
#include "../../server/TracyVersion.hpp"
|
||||||
#include "../../server/TracyView.hpp"
|
#include "../../server/TracyView.hpp"
|
||||||
#include "../../server/TracyWorker.hpp"
|
#include "../../server/TracyWorker.hpp"
|
||||||
#include "../../server/TracyVersion.hpp"
|
#include "../../server/TracyVersion.hpp"
|
||||||
@ -117,7 +118,7 @@ static tracy::BadVersionState badVer;
|
|||||||
static int port = 8086;
|
static int port = 8086;
|
||||||
static const char* connectTo = nullptr;
|
static const char* connectTo = nullptr;
|
||||||
static char title[128];
|
static char title[128];
|
||||||
static std::thread loadThread;
|
static std::thread loadThread, updateThread;
|
||||||
static std::unique_ptr<tracy::UdpListen> broadcastListen;
|
static std::unique_ptr<tracy::UdpListen> broadcastListen;
|
||||||
static std::mutex resolvLock;
|
static std::mutex resolvLock;
|
||||||
static tracy::unordered_flat_map<std::string, std::string> resolvMap;
|
static tracy::unordered_flat_map<std::string, std::string> resolvMap;
|
||||||
@ -135,6 +136,7 @@ static ImGuiTextFilter addrFilter, portFilter, progFilter;
|
|||||||
static std::thread::id mainThread;
|
static std::thread::id mainThread;
|
||||||
static std::vector<std::function<void()>> mainThreadTasks;
|
static std::vector<std::function<void()>> mainThreadTasks;
|
||||||
static std::mutex mainThreadLock;
|
static std::mutex mainThreadLock;
|
||||||
|
static uint32_t updateVersion = 0;
|
||||||
|
|
||||||
void RunOnMainThread( std::function<void()> cb )
|
void RunOnMainThread( std::function<void()> cb )
|
||||||
{
|
{
|
||||||
@ -223,6 +225,21 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
mainThread = std::this_thread::get_id();
|
mainThread = std::this_thread::get_id();
|
||||||
|
|
||||||
|
updateThread = std::thread( [] {
|
||||||
|
tracy::Socket sock;
|
||||||
|
if( !sock.ConnectBlocking( "51.89.23.220", 8099 ) ) return;
|
||||||
|
char request[1024];
|
||||||
|
const auto len = sprintf( request, "GET /tracy/version HTTP/1.1\r\nHost: 51.89.23.220\r\nUser-Agent: Tracy Profiler %i.%i.%i\r\nConnection: close\r\nCache-Control: no-cache, no-store, must-revalidate\r\n\r\n", tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch );
|
||||||
|
sock.Send( request, len );
|
||||||
|
char response[1024];
|
||||||
|
const auto sz = sock.ReadUpTo( response, 1024, 15 );
|
||||||
|
if( sz < 13 ) return;
|
||||||
|
if( memcmp( response, "HTTP/1.1 200", 12 ) != 0 ) return;
|
||||||
|
uint32_t ver;
|
||||||
|
memcpy( &ver, response + sz - 4, 4 );
|
||||||
|
RunOnMainThread( [ver] { updateVersion = ver; } );
|
||||||
|
} );
|
||||||
|
|
||||||
// Setup window
|
// Setup window
|
||||||
glfwSetErrorCallback(glfw_error_callback);
|
glfwSetErrorCallback(glfw_error_callback);
|
||||||
if( !glfwInit() ) return 1;
|
if( !glfwInit() ) return 1;
|
||||||
@ -369,6 +386,7 @@ int main( int argc, char** argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( loadThread.joinable() ) loadThread.join();
|
if( loadThread.joinable() ) loadThread.join();
|
||||||
|
if( updateThread.joinable() ) updateThread.join();
|
||||||
view.reset();
|
view.reset();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user