diff --git a/ext/clementine-tagreader/main.cpp b/ext/clementine-tagreader/main.cpp index 5440baade..37481a5d1 100644 --- a/ext/clementine-tagreader/main.cpp +++ b/ext/clementine-tagreader/main.cpp @@ -24,6 +24,7 @@ #include #include +#include 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]; diff --git a/ext/clementine-tagreader/tagreaderworker.cpp b/ext/clementine-tagreader/tagreaderworker.cpp index f5f08bd94..d0b6c3ff8 100644 --- a/ext/clementine-tagreader/tagreaderworker.cpp +++ b/ext/clementine-tagreader/tagreaderworker.cpp @@ -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());