RemotePlugin: better code order in sendMessage() + cleanups
We can cache the number of data sets in the message in order to avoid duplicate data::size() calls. Furthermore the accumulation of the size of the written data is an old relict and can be safely removed.
This commit is contained in:
@@ -922,14 +922,13 @@ RemotePluginBase::~RemotePluginBase()
|
||||
|
||||
void RemotePluginBase::sendMessage( const message & _m )
|
||||
{
|
||||
const int n = _m.data.size();
|
||||
m_out->lock();
|
||||
m_out->writeInt( _m.id );
|
||||
m_out->writeInt( _m.data.size() );
|
||||
int j = 0;
|
||||
for( unsigned int i = 0; i < _m.data.size(); ++i )
|
||||
m_out->writeInt( n );
|
||||
for( unsigned int i = 0; i < n; ++i )
|
||||
{
|
||||
m_out->writeString( _m.data[i] );
|
||||
j += _m.data[i].size();
|
||||
}
|
||||
m_out->unlock();
|
||||
m_out->messageSent();
|
||||
|
||||
Reference in New Issue
Block a user