Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

static void SVCServiceRunLoop ( void   ) [static]

The Server's Message Queue Listener function.

An endless loop calls the function ProcessEventsServer() to check for messages sent by clients. If the message is valid, CreateContextThread() is called to serve this request.

Definition at line 79 of file pcscdaemon.c.

References CreateContextThread(), ProcessEventsServer(), SCARD_S_SUCCESS, and SYS_Sleep().

{
      int rsp;
      LONG rv;
      uint32_t dwClientID;    /* Connection ID used to reference the Client */

      while (TRUE)
      {
            switch (rsp = ProcessEventsServer(&dwClientID))
            {

            case 0:
                  Log2(PCSC_LOG_DEBUG, "A new context thread creation is requested: %d", dwClientID);
                  rv = CreateContextThread(&dwClientID);

                  if (rv != SCARD_S_SUCCESS)
                        Log1(PCSC_LOG_ERROR, "Problem during the context thread creation");
                  break;

            case 2:
                  /*
                   * timeout in ProcessEventsServer(): do nothing
                   * this is used to catch the Ctrl-C signal at some time when
                   * nothing else happens
                   */
                  break;

            case -1:
                  Log1(PCSC_LOG_ERROR, "Error in ProcessEventsServer");
                  break;

            case -2:
                  /* Nothing to do in case of a syscall interrupted
                   * It happens when SIGUSR1 (reload) or SIGINT (Ctrl-C) is received
                   * We just try again */
                  break;

            default:
                  Log2(PCSC_LOG_ERROR, "ProcessEventsServer unknown retval: %d",
                        rsp);
                  break;
            }

            if (AraKiri)
            {
                  /* stop the hotpug thread and waits its exit */
#ifdef USE_USB
                  (void)HPStopHotPluggables();
#endif
                  (void)SYS_Sleep(1);

                  /* now stop all the drivers */
                  RFCleanupReaders();
                  ContextsDeinitialize();
                  at_exit();
            }
      }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index