|
Lines 354-360
Link Here
|
| 354 |
|
354 |
|
| 355 |
Slave* Slave::createSlave( const QString &protocol, const KURL& url, int& error, QString& error_text ) |
355 |
Slave* Slave::createSlave( const QString &protocol, const KURL& url, int& error, QString& error_text ) |
| 356 |
{ |
356 |
{ |
| 357 |
//kdDebug(7002) << "createSlave '" << protocol << "' for " << url.prettyURL() << endl; |
357 |
kdDebug(7002) << "createSlave '" << protocol << "' for " << url.prettyURL() << endl; |
| 358 |
// Firstly take into account all special slaves |
358 |
// Firstly take into account all special slaves |
| 359 |
if (protocol == "data") |
359 |
if (protocol == "data") |
| 360 |
return new DataProtocol(); |
360 |
return new DataProtocol(); |
|
Lines 432-460
Link Here
|
| 432 |
stream << protocol << url.host() << socketfile.name(); |
432 |
stream << protocol << url.host() << socketfile.name(); |
| 433 |
|
433 |
|
| 434 |
QCString launcher = KApplication::launcher(); |
434 |
QCString launcher = KApplication::launcher(); |
| 435 |
if (!client->call(launcher, launcher, "requestSlave(QString,QString,QString)", |
435 |
// FIXME: there is a bug in dcop that makes it reply requests out |
| 436 |
params, replyType, reply)) { |
436 |
// of order and the messages are then wrongly delivered. |
| 437 |
error_text = i18n("Cannot talk to klauncher"); |
437 |
// We didn't find the proper fix, so we are just trying more than once |
| 438 |
error = KIO::ERR_SLAVE_DEFINED; |
438 |
// to make the call praying for it to reply correctly. |
| 439 |
delete slave; |
439 |
|
| 440 |
return 0; |
440 |
if (!client->call(launcher, launcher, "requestSlave(QString,QString,QString)", params, replyType, reply)) |
| 441 |
} |
441 |
{ |
| 442 |
QDataStream stream2(reply, IO_ReadOnly); |
442 |
kdDebug() << "slave: 1 - requestSlave() returned wrong type = " << replyType << endl; |
| 443 |
QString errorStr; |
443 |
error_text = i18n("Cannot talk to klauncher"); |
| 444 |
pid_t pid; |
444 |
error = KIO::ERR_SLAVE_DEFINED; |
| 445 |
stream2 >> pid >> errorStr; |
445 |
delete slave; |
| 446 |
if (!pid) |
446 |
return 0; |
| 447 |
{ |
447 |
} |
| 448 |
error_text = i18n("Unable to create io-slave:\nklauncher said: %1").arg(errorStr); |
448 |
|
| 449 |
error = KIO::ERR_CANNOT_LAUNCH_PROCESS; |
449 |
if (replyType == "QString") |
| 450 |
delete slave; |
450 |
{ |
| 451 |
return 0; |
451 |
QDataStream stream2(reply, IO_ReadOnly); |
| 452 |
} |
452 |
QString errorStr; |
|
|
453 |
pid_t pid; |
| 454 |
stream2 >> pid >> errorStr; |
| 455 |
if (!pid) |
| 456 |
{ |
| 457 |
error_text = i18n("Unable to create io-slave:\nklauncher said: %1").arg(errorStr); |
| 458 |
error = KIO::ERR_CANNOT_LAUNCH_PROCESS; |
| 459 |
delete slave; |
| 460 |
return 0; |
| 461 |
} |
| 453 |
#ifndef Q_WS_WIN |
462 |
#ifndef Q_WS_WIN |
| 454 |
slave->setPID(pid); |
463 |
slave->setPID(pid); |
| 455 |
QTimer::singleShot(1000*SLAVE_CONNECTION_TIMEOUT_MIN, slave, SLOT(timeout())); |
464 |
QTimer::singleShot(1000*SLAVE_CONNECTION_TIMEOUT_MIN, slave, SLOT(timeout())); |
| 456 |
#endif |
465 |
#endif |
| 457 |
return slave; |
466 |
} |
|
|
467 |
else |
| 468 |
kdDebug() << "slave: 2 - requestSlave() returned wrong type = " << replyType << endl; |
| 469 |
return slave; |
| 458 |
} |
470 |
} |
| 459 |
|
471 |
|
| 460 |
Slave* Slave::holdSlave( const QString &protocol, const KURL& url ) |
472 |
Slave* Slave::holdSlave( const QString &protocol, const KURL& url ) |