author | zecke <zecke> | 2002-10-16 15:34:05 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-16 15:34:05 (UTC) |
commit | 321cea04e34658fde3de47c104682b5cefce6eeb (patch) (side-by-side diff) | |
tree | abdf45ae54d24dedfd20e4e40371df5f39687139 /x11/ipc/client | |
parent | 61f2f6ef32685002710f197dc8990fd9e99d83a5 (diff) | |
download | opie-321cea04e34658fde3de47c104682b5cefce6eeb.zip opie-321cea04e34658fde3de47c104682b5cefce6eeb.tar.gz opie-321cea04e34658fde3de47c104682b5cefce6eeb.tar.bz2 |
more implementation!!
OCOPClient now tries to start the server
-rw-r--r-- | x11/ipc/client/ocopclient.cpp | 21 | ||||
-rw-r--r-- | x11/ipc/client/ocopclient.h | 4 |
2 files changed, 24 insertions, 1 deletions
diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp index 43e426c..ac6e4a3 100644 --- a/x11/ipc/client/ocopclient.cpp +++ b/x11/ipc/client/ocopclient.cpp @@ -5,2 +5,3 @@ #include <sys/socket.h> +#include <sys/types.h> #include <sys/un.h> @@ -18,2 +19,3 @@ OCOPClient::OCOPClient( const QString& path, QObject* obj ) { + m_tries = 0; init(QFile::encodeName(path) ); @@ -21,5 +23,13 @@ OCOPClient::OCOPClient( const QString& path, QObject* obj ) OCOPClient::~OCOPClient() { + delete m_notify; close( m_socket ); } +void OCOPClient::init() { + // failed start ther server NOW!!! + startUP(); + QCString str; + init(str ); +} void OCOPClient::init( const QCString& ) { + m_tries++; struct sockaddr_un unix_adr; @@ -27,2 +37,3 @@ void OCOPClient::init( const QCString& ) { qWarning("could not socket"); + if ( m_tries < 8 ) QTimer::singleShot(400, this,SLOT(init() ) ); @@ -38,2 +49,3 @@ void OCOPClient::init( const QCString& ) { close( m_socket ); + if ( m_tries < 8 ) QTimer::singleShot(400, this, SLOT(init() ) ); @@ -129 +141,10 @@ void OCOPClient::call( const OCOPPacket& pack ) { } +void OCOPClient::startUP() { + qWarning("Start me up"); + pid_t pi = fork(); + if ( pi == 0 ) { + setsid(); + execlp("opie-ipc", "opie-ipc", NULL ); + _exit(1); + } +} diff --git a/x11/ipc/client/ocopclient.h b/x11/ipc/client/ocopclient.h index e9544b9..53018a5 100644 --- a/x11/ipc/client/ocopclient.h +++ b/x11/ipc/client/ocopclient.h @@ -46,2 +46,3 @@ signals: private slots: + void init(); void init(const QCString& pa); @@ -49,2 +50,3 @@ private slots: private: + void startUP(); OCOPPacket packet()const; @@ -54,3 +56,3 @@ private: int m_socket; -private slots: + int m_tries; |