summaryrefslogtreecommitdiff
path: root/x11/ipc/client/ocopclient.cpp
Side-by-side diff
Diffstat (limited to 'x11/ipc/client/ocopclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/ipc/client/ocopclient.cpp25
1 files changed, 23 insertions, 2 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,3 +37,4 @@ void OCOPClient::init( const QCString& ) {
qWarning("could not socket");
- QTimer::singleShot(400, this,SLOT(init() ) );
+ if ( m_tries < 8 )
+ QTimer::singleShot(400, this,SLOT(init() ) );
return;
@@ -38,3 +49,4 @@ void OCOPClient::init( const QCString& ) {
close( m_socket );
- QTimer::singleShot(400, this, SLOT(init() ) );
+ if ( m_tries < 8 )
+ QTimer::singleShot(400, this, SLOT(init() ) );
return;
@@ -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);
+ }
+}