mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
Changed the xml::Socket buffer to a std::string. Seemed to have some memleaks before :)
This commit is contained in:
parent
5de89cb4f4
commit
605d66ae72
@ -93,7 +93,8 @@ bool SocketWriter::Write(const char* buffer,long bytes){
|
||||
this->Flush();
|
||||
}
|
||||
|
||||
CopyMemory(this->buffer.c_array()+this->bufferSize, buffer, bytes);
|
||||
this->buffer.append(buffer,bytes);
|
||||
//CopyMemory(this->buffer.c_array()+this->bufferSize, buffer, bytes);
|
||||
this->bufferSize += bytes;
|
||||
|
||||
return !this->exited;
|
||||
@ -103,10 +104,11 @@ void SocketWriter::Flush(){
|
||||
if(this->bufferSize && !this->Exited()){
|
||||
boost::system::error_code error;
|
||||
try{
|
||||
boost::asio::write(this->socket,boost::asio::buffer(this->buffer,this->bufferSize));
|
||||
boost::asio::write(this->socket,boost::asio::buffer(this->buffer));
|
||||
}catch(...){
|
||||
this->exited = true;
|
||||
}
|
||||
this->buffer.clear();
|
||||
this->bufferSize = 0;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,8 @@ class SocketWriter : public IWriteSupplier{
|
||||
boost::asio::ip::tcp::socket &socket;
|
||||
bool exited;
|
||||
long bufferSize;
|
||||
boost::array<char, 4096> buffer;
|
||||
//boost::array<char, 4096> buffer;
|
||||
std::string buffer;
|
||||
|
||||
long maxBufferSize;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user