diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/listener.cpp | 9 | ||||
-rw-r--r-- | common/listener.h | 3 |
2 files changed, 0 insertions, 12 deletions
diff --git a/common/listener.cpp b/common/listener.cpp index 8ec9b3e..96d87be 100644 --- a/common/listener.cpp +++ b/common/listener.cpp | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <QLocalSocket> | 34 | #include <QLocalSocket> |
35 | #include <QTimer> | 35 | #include <QTimer> |
36 | #include <QLockFile> | ||
37 | 36 | ||
38 | Listener::Listener(const QByteArray &resourceInstanceIdentifier, QObject *parent) | 37 | Listener::Listener(const QByteArray &resourceInstanceIdentifier, QObject *parent) |
39 | : QObject(parent), | 38 | : QObject(parent), |
@@ -48,15 +47,7 @@ Listener::Listener(const QByteArray &resourceInstanceIdentifier, QObject *parent | |||
48 | this, &Listener::acceptConnection); | 47 | this, &Listener::acceptConnection); |
49 | Trace() << "Trying to open " << m_resourceInstanceIdentifier; | 48 | Trace() << "Trying to open " << m_resourceInstanceIdentifier; |
50 | 49 | ||
51 | m_lockfile = new QLockFile(m_resourceInstanceIdentifier + ".lock"); | ||
52 | m_lockfile->setStaleLockTime(0); | ||
53 | if (!m_lockfile->tryLock(0)) { | ||
54 | Warning() << "Failed to acquire exclusive lock on socket."; | ||
55 | exit(-1); | ||
56 | } | ||
57 | |||
58 | if (!m_server->listen(QString::fromLatin1(m_resourceInstanceIdentifier))) { | 50 | if (!m_server->listen(QString::fromLatin1(m_resourceInstanceIdentifier))) { |
59 | // FIXME: multiple starts need to be handled here | ||
60 | m_server->removeServer(m_resourceInstanceIdentifier); | 51 | m_server->removeServer(m_resourceInstanceIdentifier); |
61 | if (!m_server->listen(QString::fromLatin1(m_resourceInstanceIdentifier))) { | 52 | if (!m_server->listen(QString::fromLatin1(m_resourceInstanceIdentifier))) { |
62 | Warning() << "Utter failure to start server"; | 53 | Warning() << "Utter failure to start server"; |
diff --git a/common/listener.h b/common/listener.h index 0d19823..2d69c35 100644 --- a/common/listener.h +++ b/common/listener.h | |||
@@ -53,8 +53,6 @@ public: | |||
53 | QByteArray commandBuffer; | 53 | QByteArray commandBuffer; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | class QLockFile; | ||
57 | |||
58 | class Listener : public QObject | 56 | class Listener : public QObject |
59 | { | 57 | { |
60 | Q_OBJECT | 58 | Q_OBJECT |
@@ -95,5 +93,4 @@ private: | |||
95 | QTimer *m_clientBufferProcessesTimer; | 93 | QTimer *m_clientBufferProcessesTimer; |
96 | QTimer *m_checkConnectionsTimer; | 94 | QTimer *m_checkConnectionsTimer; |
97 | int m_messageId; | 95 | int m_messageId; |
98 | QLockFile *m_lockfile; | ||
99 | }; | 96 | }; |