Commit 94aa17b5 authored by Frederic Logier's avatar Frederic Logier
Browse files

removed some memory leaks on mongodb wrapper

parent a8aa6eb1
......@@ -46,7 +46,7 @@ void Alert::sendEmail(QString worker)
m_smtp = new QxtSmtp();
m_smtp = new QxtSmtp(this);
connect(m_smtp, SIGNAL(mailFailed(int,int)), this, SLOT(failed()));
connect(m_smtp, SIGNAL(mailSent(int)), this, SLOT(success()));
......
......@@ -528,6 +528,7 @@ QBool Mongodb::ReadFile(const be &gfs_id, const mongo::GridFile **a_gf)
else break;
}
replicaset.done();
delete(*a_gf);
return QBool(true);
}
}
......@@ -560,8 +561,8 @@ int Mongodb::GetNumChunck(const be &gfs_id)
qDebug() << "Mongodb::ExtractByChunck OPEN";
if (!m_grid_file->exists()) {
std::cout << "Mongodb::ExtractByChunck file not found" << std::endl;
delete(m_grid_file);
replicaset.done();
delete(m_grid_file);
return -1;
}
else
......@@ -571,6 +572,7 @@ int Mongodb::GetNumChunck(const be &gfs_id)
std::cout << "Mongodb::ExtractByChunck NUM CHUCK : " << num << std::endl;
replicaset.done();
delete(m_grid_file);
return num;
}
}
......@@ -605,8 +607,8 @@ string Mongodb::GetFilename(const be &gfs_id)
qDebug() << "Mongodb::GetFilename OPEN";
if (!m_grid_file->exists()) {
std::cout << "Mongodb::GetFilename file not found" << std::endl;
delete(m_grid_file);
replicaset.done();
delete(m_grid_file);
return "";
}
else
......@@ -614,6 +616,7 @@ string Mongodb::GetFilename(const be &gfs_id)
string filename = m_grid_file->getFilename();
std::cout << "Mongodb::GetFilename FILE NAME : " << filename << std::endl;
replicaset.done();
delete(m_grid_file);
return filename;
}
}
......@@ -651,8 +654,8 @@ BSONObj Mongodb::GetGfsid(const string filename)
qDebug() << "Mongodb::GetGfsid OPEN";
if (!m_grid_file->exists()) {
std::cout << "Mongodb::GetGfsid file not found" << std::endl;
delete(m_grid_file);
replicaset.done();
delete(m_grid_file);
return gfsid_;
}
else
......@@ -662,6 +665,7 @@ BSONObj Mongodb::GetGfsid(const string filename)
gfsid_ = BSON("_id" << gfsid);
std::cout << "Mongodb::GetGfsid2 : " << gfsid_ << std::endl;
replicaset.done();
delete(m_grid_file);
return gfsid_;
}
}
......@@ -726,16 +730,16 @@ QBool Mongodb::ExtractByChunck(const be &gfs_id, int chunk_index, QByteArray &ch
std::cout << "Mongodb::ExtractByChunck CHUNCK SIZE : " << chunk_data.size() << std::endl;
delete(m_grid_file);
replicaset.done();
delete(m_grid_file);
return QBool(true);
}
else
{
//*chunk_data = NULL;
chunk_data.clear();
delete(m_grid_file);
replicaset.done();
delete(m_grid_file);
return QBool(false);
}
}
......
......@@ -49,8 +49,6 @@ void GridfsTask::run()
}
else
{
delete(m_requestContent);
std::cout << "writefile : " << gfs_file_struct << std::endl;
//std::cout << "writefile id : " << gfs_file_struct.getField("_id") << " date : " << gfs_file_struct.getField("uploadDate") << std::endl;
......@@ -77,10 +75,9 @@ void GridfsTask::run()
payload_builder.append("gridfs", false);
m_zerogw["data"] = QString::fromAscii(m_requestContent->constData(), m_requestContent->size());
payload_builder.append("data", m_zerogw["data"].toStdString());
delete(m_requestContent);
}
delete(m_requestContent);
payload_builder.append("timestamp", m_zerogw["timestamp"].toUInt());
......
......@@ -60,7 +60,7 @@ Ztracker::Ztracker(zmq::context_t *a_context, QObject *parent) : m_context(a_con
m_data_socket->bind("ipc:///tmp/nodecast/workers");
**********************************************/
worker_timer = new QTimer();
worker_timer = new QTimer(this);
connect(worker_timer, SIGNAL(timeout()), this, SLOT(worker_update_ticker ()), Qt::DirectConnection);
worker_timer->start (5000);
}
......@@ -786,7 +786,7 @@ Zdispatch::Zdispatch(zmq::context_t *a_context, QObject *parent) : m_context(a_c
replay_payload_timer = new QTimer();
replay_payload_timer = new QTimer(this);
connect(replay_payload_timer, SIGNAL(timeout()), this, SLOT(replay_payload ()), Qt::DirectConnection);
//replay_payload_timer->start (60000);
replay_payload_timer->start (60000);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment