fix a cleanup-handler related issue in sstream.cpp / sched_remote.cpp

metadata
Wenzel Jakob 2013-12-03 15:42:40 +01:00
parent 687b56e73d
commit 6777864990
2 changed files with 6 additions and 2 deletions

View File

@ -73,6 +73,9 @@ RemoteWorker::RemoteWorker(const std::string &name, Stream *stream) : Worker(nam
RemoteWorker::~RemoteWorker() {
Log(EDebug, "Shutting down");
if (!m_reader || !m_mutex || !m_memStream)
return;
LockGuard lock(m_mutex);
m_reader->shutdown();
m_memStream->writeShort(StreamBackend::EQuit);

View File

@ -39,6 +39,9 @@
MTS_NAMESPACE_BEGIN
static StatsCounter bytesRcvd("Network", "Bytes received");
static StatsCounter bytesSent("Network", "Bytes sent");
namespace
{
#if defined(WIN32)
@ -155,7 +158,6 @@ SocketStream::~SocketStream() {
}
void SocketStream::read(void *ptr, size_t size) {
static StatsCounter bytesRcvd("Network", "Bytes received");
const size_t total = size;
char *data = (char *) ptr;
while (size > 0) {
@ -180,7 +182,6 @@ void SocketStream::read(void *ptr, size_t size) {
}
void SocketStream::write(const void *ptr, size_t size) {
static StatsCounter bytesSent("Network", "Bytes sent");
const size_t total = size;
char *data = (char *) ptr;
while (size > 0) {