Add some debugging code to the tagreader worker that makes it crash randomly.

This commit is contained in:
David Sansome 2012-01-22 18:34:26 +00:00
parent 396f375e8d
commit 84a1ae2f87
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <QStringList>
#include <iostream>
#include <sys/time.h>
int main(int argc, char** argv) {
QCoreApplication a(argc, argv);
@ -36,6 +37,11 @@ int main(int argc, char** argv) {
return 1;
}
// Seed random number generator
timeval time;
gettimeofday(&time,NULL);
qsrand((time.tv_sec * 1000) + (time.tv_usec / 1000));
logging::Init();
qLog(Info) << "TagReader worker connecting to" << args[1];

View File

@ -100,6 +100,14 @@ TagReaderWorker::TagReaderWorker(QIODevice* socket, QObject* parent)
void TagReaderWorker::MessageArrived(const pb::tagreader::Message& message) {
pb::tagreader::Message reply;
#if 0
// Crash every few requests
if (qrand() % 10 == 0) {
qLog(Debug) << "Crashing on request ID" << message.id();
abort();
}
#endif
if (message.has_read_file_request()) {
ReadFile(QStringFromStdString(message.read_file_request().filename()),
reply.mutable_read_file_response()->mutable_metadata());