Track space left in send buffer.

This commit is contained in:
Bartosz Taudul 2019-04-01 19:37:39 +02:00
parent 57dff0abc9
commit deeea0ee70

View File

@ -1814,6 +1814,7 @@ close:
void Worker::Query( ServerQuery type, uint64_t data ) void Worker::Query( ServerQuery type, uint64_t data )
{ {
ServerQueryPacket query = { type, data }; ServerQueryPacket query = { type, data };
m_serverQuerySpaceLeft--;
m_sock.Send( &query, ServerQueryPacketSize ); m_sock.Send( &query, ServerQueryPacketSize );
} }
@ -1832,12 +1833,15 @@ bool Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
break; break;
case QueueType::StringData: case QueueType::StringData:
AddString( ev.stringTransfer.ptr, ptr, sz ); AddString( ev.stringTransfer.ptr, ptr, sz );
m_serverQuerySpaceLeft++;
break; break;
case QueueType::ThreadName: case QueueType::ThreadName:
AddThreadString( ev.stringTransfer.ptr, ptr, sz ); AddThreadString( ev.stringTransfer.ptr, ptr, sz );
m_serverQuerySpaceLeft++;
break; break;
case QueueType::PlotName: case QueueType::PlotName:
HandlePlotName( ev.stringTransfer.ptr, ptr, sz ); HandlePlotName( ev.stringTransfer.ptr, ptr, sz );
m_serverQuerySpaceLeft++;
break; break;
case QueueType::SourceLocationPayload: case QueueType::SourceLocationPayload:
AddSourceLocationPayload( ev.stringTransfer.ptr, ptr, sz ); AddSourceLocationPayload( ev.stringTransfer.ptr, ptr, sz );
@ -1847,6 +1851,7 @@ bool Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
break; break;
case QueueType::FrameName: case QueueType::FrameName:
HandleFrameName( ev.stringTransfer.ptr, ptr, sz ); HandleFrameName( ev.stringTransfer.ptr, ptr, sz );
m_serverQuerySpaceLeft++;
break; break;
case QueueType::CallstackAllocPayload: case QueueType::CallstackAllocPayload:
AddCallstackAllocPayload( ev.stringTransfer.ptr, ptr, sz ); AddCallstackAllocPayload( ev.stringTransfer.ptr, ptr, sz );
@ -2435,6 +2440,7 @@ bool Worker::Process( const QueueItem& ev )
break; break;
case QueueType::SourceLocation: case QueueType::SourceLocation:
AddSourceLocation( ev.srcloc ); AddSourceLocation( ev.srcloc );
m_serverQuerySpaceLeft++;
break; break;
case QueueType::ZoneText: case QueueType::ZoneText:
ProcessZoneText( ev.zoneText ); ProcessZoneText( ev.zoneText );
@ -2516,6 +2522,7 @@ bool Worker::Process( const QueueItem& ev )
break; break;
case QueueType::CallstackFrameSize: case QueueType::CallstackFrameSize:
ProcessCallstackFrameSize( ev.callstackFrameSize ); ProcessCallstackFrameSize( ev.callstackFrameSize );
m_serverQuerySpaceLeft++;
break; break;
case QueueType::CallstackFrame: case QueueType::CallstackFrame:
ProcessCallstackFrame( ev.callstackFrame ); ProcessCallstackFrame( ev.callstackFrame );