Пример #1
0
/* Add a function to monitor socket */
LPSELECTDATA socket_poll_add (LPSELECTDATA lpSelectData, 
                              SELECTMODE EMode, 
                              HANDLE hFileDescr, 
                              int lpOrigIdx,
                              unsigned int uFlagsFd)
{
  LPSELECTDATA res;
  LPSELECTDATA hd;
  
  hd = lpSelectData;
  /* Polling socket can be done mulitple handle at the same time. You just
     need one worker to use it. Try to find if there is already a worker
     handling this kind of request.
     */
  DEBUG_PRINT("Scanning list of worker to find one that already handle socket");
  res = select_data_job_search(&hd, SELECT_TYPE_SOCKET);
  
  /* Add a new socket to poll */
  res->funcWorker = socket_poll;
  DEBUG_PRINT("Add socket %x to worker", hFileDescr);
  select_data_query_add(res, EMode, hFileDescr, lpOrigIdx, uFlagsFd);
  DEBUG_PRINT("Socket %x added", hFileDescr);

  return hd;
}
Пример #2
0
/* Add a function to monitor socket */
LPSELECTDATA socket_poll_add (LPSELECTDATA lpSelectData, SELECTMODE EMode, HANDLE hFileDescr, LPVOID lpOrig)
{
  LPSELECTDATA res;
  LPSELECTDATA hd;
  
  hd = lpSelectData;
  /* Polling socket can be done mulitple handle at the same time. You just
     need one worker to use it. Try to find if there is already a worker
     handling this kind of request.
     */
#ifdef DBUG
  dbug_print("Scanning list of worker to find one that already handle socket");
#endif
  res = select_data_job_search(&hd, SELECT_TYPE_SOCKET);
  
  /* Add a new socket to poll */
  res->funcWorker = socket_poll;
#ifdef DBUG
  dbug_print("Add socket %x to worker", hFileDescr);
#endif
  select_data_query_add(res, EMode, hFileDescr, lpOrig);
#ifdef DBUG
  dbug_print("Socket %x added", hFileDescr);
#endif

  return hd;
}
Пример #3
0
/* Add a function to monitor console input */
LPSELECTDATA read_console_poll_add (LPSELECTDATA lpSelectData, SELECTMODE EMode, HANDLE hFileDescr, LPVOID lpOrig)
{
  LPSELECTDATA res;

  res = select_data_new(lpSelectData, SELECT_TYPE_CONSOLE_READ);
  res->funcWorker = read_console_poll;
  select_data_query_add(res, SELECT_MODE_READ, hFileDescr, lpOrig);

  return res;
}
Пример #4
0
/* Add a function to monitor console input */
LPSELECTDATA read_console_poll_add (LPSELECTDATA lpSelectData,
                                    SELECTMODE EMode,
                                    HANDLE hFileDescr,
                                    int lpOrigIdx,
                                    unsigned int uFlagsFd)
{
  LPSELECTDATA res;

  res = select_data_new(lpSelectData, SELECT_TYPE_CONSOLE_READ);
  res->funcWorker = read_console_poll;
  select_data_query_add(res, SELECT_MODE_READ, hFileDescr, lpOrigIdx, uFlagsFd);

  return res;
}
Пример #5
0
/* Add a static result */
LPSELECTDATA static_poll_add (LPSELECTDATA lpSelectData, SELECTMODE EMode, HANDLE hFileDescr, LPVOID lpOrig)
{
  LPSELECTDATA res;
  LPSELECTDATA hd;
  
  /* Look for an already initialized static element */
  hd = lpSelectData;
  res = select_data_job_search(&hd, SELECT_TYPE_STATIC);
  
  /* Add a new query/result */
  select_data_query_add(res, EMode, hFileDescr, lpOrig);
  select_data_result_add(res, EMode, lpOrig);

  return hd;
}
Пример #6
0
/* Add a function to monitor pipe input */
LPSELECTDATA read_pipe_poll_add (LPSELECTDATA lpSelectData, SELECTMODE EMode, HANDLE hFileDescr, LPVOID lpOrig)
{
  LPSELECTDATA res;
  LPSELECTDATA hd;
  
  hd = lpSelectData;
  /* Polling pipe is a non blocking operation by default. This means that each
     worker can handle many pipe. We begin to try to find a worker that is 
     polling pipe, but for which there is under the limit of pipe per worker.
     */
#ifdef DBUG
  dbug_print("Searching an available worker handling pipe");
#endif
  res = select_data_job_search(&hd, SELECT_TYPE_PIPE_READ);
  
  /* Add a new pipe to poll */
  res->funcWorker = read_pipe_poll;
  select_data_query_add(res, EMode, hFileDescr, lpOrig);

  return hd;
}