Exemplo n.º 1
0
void SeafileApplet::start()
{
    refreshQss();

    configurator_->checkInit();

    initLog();

    account_mgr_->start();

    certs_mgr_->start();

    AvatarService::instance()->start();
    SeahubNotificationsMonitor::instance()->start();

#if defined(Q_WS_WIN)
    QString crash_rpt_path = QDir(configurator_->ccnetDir()).filePath("logs/seafile-crash-report.txt");
    if (!g_setenv ("CRASH_RPT_PATH", toCStr(crash_rpt_path), FALSE))
        qDebug("Failed to set CRASH_RPT_PATH env variable.\n");
#endif

    daemon_mgr_->startCcnetDaemon();

    connect(daemon_mgr_, SIGNAL(daemonStarted()),
            this, SLOT(onDaemonStarted()));
}
Exemplo n.º 2
0
void SeafileApplet::start()
{
    refreshQss();

    configurator_->checkInit();

    initLog();

    account_mgr_->start();

    certs_mgr_->start();

#if defined(Q_OS_WIN32)
    QString crash_rpt_path = QDir(configurator_->ccnetDir()).filePath("logs/seafile-crash-report.txt");
    if (!g_setenv ("CRASH_RPT_PATH", toCStr(crash_rpt_path), FALSE))
        qWarning("Failed to set CRASH_RPT_PATH env variable.\n");
#endif

    //
    // start daemons
    //
    daemon_mgr_->startCcnetDaemon();

    connect(daemon_mgr_, SIGNAL(daemonStarted()),
            this, SLOT(onDaemonStarted()));
}
Exemplo n.º 3
0
QmlBackend::QmlBackend(ControlClient *controlClient, QObject *parent) :
    QObject(parent), _controlClient(controlClient), _daemonActive(false), _daemonRunning(false)
{
    connect(_controlClient, SIGNAL(activeChanged(bool)), this, SLOT(daemonActiveChanged(bool)));
    connect(_controlClient, SIGNAL(started()), this, SLOT(daemonStarted()));
    connect(_controlClient, SIGNAL(stopped()), this, SLOT(daemonStopped()));
    connect(_controlClient, SIGNAL(matchPhraseChanged(const QString &)), this, SLOT(matchPhraseChanged(const QString &)));

    _initDaemonState();
}
Exemplo n.º 4
0
void SeafileApplet::start()
{
    configurator_->checkInit();
    tray_icon_->show();

    initLog();

    account_mgr_->start();
    daemon_mgr_->startCcnetDaemon();

    connect(daemon_mgr_, SIGNAL(daemonStarted()),
            this, SLOT(onDaemonStarted()));
}
Exemplo n.º 5
0
void DaemonManager::onSeafDaemonStarted()
{
    qDebug("seafile daemon is now running");
    emit daemonStarted();
}
Exemplo n.º 6
0
int IFSEXPORT
FS_FSCTL(
   union argdat far * pArgDat,
   unsigned short iArgType,
   unsigned short usFunc,
   char far * pParm,
   unsigned short cbMaxParm,
   unsigned short far * pcbParm,
   char far * pData,
   unsigned short cbMaxData,
   unsigned short far * pcbData
   )
{
   int rc;
   struct fsctl far * p = &pRequest->data.fsctl;

   /* Validate iArgType. */
   if ((iArgType != FSCTL_ARG_FILEINSTANCE) &&
       (iArgType != FSCTL_ARG_CURDIR) &&
       (iArgType != FSCTL_ARG_NULL))
      return ERROR_NOT_SUPPORTED;

   /* Validate the parameter buffer. */
   if (cbMaxParm) {
      rc = FSH_PROBEBUF(PB_OPREAD, (char far *) pcbParm,
         sizeof(USHORT));
      if (rc) return ERROR_INVALID_PARAMETER;
      if (*pcbParm > cbMaxParm) return ERROR_INVALID_PARAMETER;
      if (*pcbParm) {
         rc = FSH_PROBEBUF(PB_OPREAD, pParm, *pcbParm);
         if (rc) return ERROR_INVALID_PARAMETER;
      }
   }

   switch (usFunc) {

      case FSCTL_STUBFSD_DAEMON_STARTED: /* daemon started */
      
         if (pidDaemon) return ERROR_STUBFSD_DAEMON_RUNNING;

         if (*pcbParm != sizeof(SETXCHGBUFFERS))
            return ERROR_INVALID_PARAMETER;

         return daemonStarted((PSETXCHGBUFFERS) pParm);

      case FSCTL_STUBFSD_DAEMON_STOPPED: /* daemon stopped */
      
         if (!pidDaemon)
            return ERROR_STUBFSD_DAEMON_NOT_RUN;

         if (queryCurrentPid() != pidDaemon)
            return ERROR_STUBFSD_NOT_DAEMON;

         return daemonStopped();

      case FSCTL_STUBFSD_RESET: /* forcibly detach daemon */
      
         return daemonStopped();

      case FSCTL_STUBFSD_GET_REQUEST: /* wait for next request */

         if (queryCurrentPid() != pidDaemon)
            return ERROR_STUBFSD_NOT_DAEMON;

         rc = FSH_SEMWAIT(&semRqAvail, TO_INFINITE);
         if (rc) return rc;
         
         rc = FSH_SEMSET(&semRqAvail);
         if (rc) return rc;

         return NO_ERROR;

      case FSCTL_STUBFSD_DONE_REQUEST: /* signal request done */
      
         if (queryCurrentPid() != pidDaemon)
            return ERROR_STUBFSD_NOT_DAEMON;

         rc = FSH_SEMCLEAR(&semRqDone);
         if (rc) return rc;

         return NO_ERROR;

      default: /* unknown FSCTL, send to daemon */

         if (rc = requestExchangeXS()) return rc;

         pRequest->rq = FSRQ_FSCTL;

         p->iArgType = iArgType;
         p->usFunc = usFunc;
         p->cbParm = cbMaxParm ? *pcbParm : 0;
         p->cbMaxData = cbMaxData;
         p->cbData = 0;

         if (cbMaxParm) memcpy(pFSData, pParm, *pcbParm);

         if (rc = signalDaemonAndWait()) RELEASE_AND_EXIT(rc);

         if (p->cbData) {
            rc = FSH_PROBEBUF(PB_OPWRITE, (char far *) pcbData,
               sizeof(USHORT));
            if (rc) RELEASE_AND_EXIT(ERROR_INVALID_PARAMETER);
            *pcbData = p->cbData;
            if (!pRequest->rc) {
               if (*pcbData > cbMaxData)
                  RELEASE_AND_EXIT(ERROR_INVALID_PARAMETER);
               if (*pcbData) {
                  rc = FSH_PROBEBUF(PB_OPWRITE, pData, *pcbData);
                  if (rc) RELEASE_AND_EXIT(ERROR_INVALID_PARAMETER);
                  memcpy(pData, pFSData, *pcbData);
               }
            }
         }
         
         RELEASE_AND_EXIT(pRequest->rc);
   }

}