mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 18:28:52 -05:00
Fix seg fault in CharonClient due to out of order initialization.
This commit is contained in:
parent
72190d93a3
commit
8e9fcffa65
|
@ -120,11 +120,8 @@ namespace Specter {
|
||||||
|
|
||||||
if (ImGui::Button("Ok"))
|
if (ImGui::Button("Ok"))
|
||||||
{
|
{
|
||||||
SPEC_INFO("Here");
|
|
||||||
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, m_bitflags);
|
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, m_bitflags);
|
||||||
SPEC_INFO("Here");
|
|
||||||
Application::Get().OnEvent(event);
|
Application::Get().OnEvent(event);
|
||||||
SPEC_INFO("Here");
|
|
||||||
|
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace Specter {
|
||||||
void ImGuiLayer::OnImGuiRender()
|
void ImGuiLayer::OnImGuiRender()
|
||||||
{
|
{
|
||||||
//Demo's used to figure out how to do things.
|
//Demo's used to figure out how to do things.
|
||||||
//Should not be on for actual NavProject for
|
//Should not be on for actual SpecProject for
|
||||||
//real use
|
//real use
|
||||||
//static bool show = true;
|
//static bool show = true;
|
||||||
//ImGui::ShowDemoWindow(&show);
|
//ImGui::ShowDemoWindow(&show);
|
||||||
|
|
|
@ -18,15 +18,14 @@ namespace Specter {
|
||||||
//loc=either an ip address or a file location, port=address port, or unused in case of file
|
//loc=either an ip address or a file location, port=address port, or unused in case of file
|
||||||
DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t header, DataSource::SourceType type, uint64_t coincidenceWindow)
|
DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t header, DataSource::SourceType type, uint64_t coincidenceWindow)
|
||||||
{
|
{
|
||||||
SPEC_INFO("Here in create with type: {0} loc:{1} port:{2} ", ConvertDataSourceTypeToString(type), location, port);
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case DataSource::SourceType::CompassOffline : SPEC_INFO("CompassOff"); return new CompassRun(location, coincidenceWindow);
|
case DataSource::SourceType::CompassOffline: return new CompassRun(location, coincidenceWindow);
|
||||||
case DataSource::SourceType::CompassOnline : SPEC_INFO("CompassOn"); return new CompassOnlineSource(location, port, header, coincidenceWindow);
|
case DataSource::SourceType::CompassOnline: return new CompassOnlineSource(location, port, header, coincidenceWindow);
|
||||||
case DataSource::SourceType::DaqromancyOffline: SPEC_INFO("DaqOff"); return new DYFileSource(location, coincidenceWindow);
|
case DataSource::SourceType::DaqromancyOffline: return new DYFileSource(location, coincidenceWindow);
|
||||||
case DataSource::SourceType::DaqromancyOnline: SPEC_INFO("DaqOn"); return new DYOnlineSource(location, port, coincidenceWindow);
|
case DataSource::SourceType::DaqromancyOnline: return new DYOnlineSource(location, port, coincidenceWindow);
|
||||||
case DataSource::SourceType::CharonOnline: SPEC_INFO("CharOn"); return new CharonOnlineSource(location, port);
|
case DataSource::SourceType::CharonOnline: return new CharonOnlineSource(location, port);
|
||||||
case DataSource::SourceType::None: SPEC_INFO("None"); return nullptr;
|
case DataSource::SourceType::None: return nullptr;
|
||||||
}
|
}
|
||||||
SPEC_WARN("Invalid DataSourceType at CreateDataSource!");
|
SPEC_WARN("Invalid DataSourceType at CreateDataSource!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -37,8 +36,8 @@ namespace Specter {
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case DataSource::SourceType::None: return "None";
|
case DataSource::SourceType::None: return "None";
|
||||||
case DataSource::SourceType::CompassOnline : return "CompassOnline";
|
case DataSource::SourceType::CompassOnline: return "CompassOnline";
|
||||||
case DataSource::SourceType::CompassOffline : return "CompassOffline";
|
case DataSource::SourceType::CompassOffline: return "CompassOffline";
|
||||||
case DataSource::SourceType::DaqromancyOffline: return "DaqromancyOffline";
|
case DataSource::SourceType::DaqromancyOffline: return "DaqromancyOffline";
|
||||||
case DataSource::SourceType::DaqromancyOnline: return "DaqromancyOnline";
|
case DataSource::SourceType::DaqromancyOnline: return "DaqromancyOnline";
|
||||||
case DataSource::SourceType::CharonOnline: return "CharonOnline";
|
case DataSource::SourceType::CharonOnline: return "CharonOnline";
|
||||||
|
|
|
@ -109,7 +109,6 @@ namespace Specter {
|
||||||
SPEC_PROFILE_FUNCTION();
|
SPEC_PROFILE_FUNCTION();
|
||||||
std::scoped_lock<std::mutex> guard(m_sourceMutex); //Shouldn't matter for this, but safety first
|
std::scoped_lock<std::mutex> guard(m_sourceMutex); //Shouldn't matter for this, but safety first
|
||||||
m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetBitFlags(), event.GetSourceType(), event.GetCoincidenceWindow()));
|
m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetBitFlags(), event.GetSourceType(), event.GetCoincidenceWindow()));
|
||||||
SPEC_INFO("Here");
|
|
||||||
if (m_source->IsValid())
|
if (m_source->IsValid())
|
||||||
{
|
{
|
||||||
SPEC_INFO("Attach successful. Enabling data pull...");
|
SPEC_INFO("Attach successful. Enabling data pull...");
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Specter {
|
||||||
CharonClient::CharonClient(const std::string& hostname, const std::string& port) :
|
CharonClient::CharonClient(const std::string& hostname, const std::string& port) :
|
||||||
m_socket(m_context)
|
m_socket(m_context)
|
||||||
{
|
{
|
||||||
SPEC_INFO("here");
|
|
||||||
Connect(hostname, port);
|
Connect(hostname, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace Specter {
|
||||||
void ReadHeader();
|
void ReadHeader();
|
||||||
void ReadBody();
|
void ReadBody();
|
||||||
|
|
||||||
asio::ip::tcp::socket m_socket;
|
|
||||||
asio::io_context m_context;
|
asio::io_context m_context;
|
||||||
|
asio::ip::tcp::socket m_socket;
|
||||||
std::thread m_ioThread;
|
std::thread m_ioThread;
|
||||||
|
|
||||||
StygianMessage m_tempMessage;
|
StygianMessage m_tempMessage;
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace Specter {
|
||||||
CharonOnlineSource::CharonOnlineSource(const std::string& hostname, const std::string& port) :
|
CharonOnlineSource::CharonOnlineSource(const std::string& hostname, const std::string& port) :
|
||||||
DataSource(0), m_client(hostname, port)
|
DataSource(0), m_client(hostname, port)
|
||||||
{
|
{
|
||||||
SPEC_INFO("Here");
|
|
||||||
m_validFlag = m_client.IsConnected();
|
m_validFlag = m_client.IsConnected();
|
||||||
m_readyEvents.emplace_back();
|
m_readyEvents.emplace_back();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user