Allow sending immediate termination query from server.

This commit is contained in:
Bartosz Taudul 2019-06-09 15:58:56 +02:00
parent 139299389b
commit 2c780f1af4
2 changed files with 9 additions and 2 deletions

View File

@ -1841,7 +1841,7 @@ void Worker::Exec()
}
}
m_serverQuerySpaceLeft = m_sock.GetSendBufSize() / ServerQueryPacketSize;
m_serverQuerySpaceLeft = ( m_sock.GetSendBufSize() / ServerQueryPacketSize ) - ServerQueryPacketSize; // leave space for terminate request
m_hasData.store( true, std::memory_order_release );
LZ4_setStreamDecode( m_stream, nullptr, 0 );
@ -1936,7 +1936,7 @@ close:
void Worker::Query( ServerQuery type, uint64_t data )
{
ServerQueryPacket query = { type, data };
ServerQueryPacket query { type, data };
if( m_serverQuerySpaceLeft > 0 )
{
m_serverQuerySpaceLeft--;
@ -1948,6 +1948,12 @@ void Worker::Query( ServerQuery type, uint64_t data )
}
}
void Worker::QueryTerminate()
{
ServerQueryPacket query { ServerQueryTerminate, 0 };
m_sock.Send( &query, ServerQueryPacketSize );
}
bool Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
{
if( ev.hdr.idx >= (int)QueueType::StringData )

View File

@ -353,6 +353,7 @@ public:
private:
void Exec();
void Query( ServerQuery type, uint64_t data );
void QueryTerminate();
tracy_force_inline bool DispatchProcess( const QueueItem& ev, char*& ptr );
tracy_force_inline bool Process( const QueueItem& ev );