示例#1
0
文件: reply_send.c 项目: dbeer/torque
int reply_send_svr(
  
  struct batch_request *request)  /* I (freed) */

  {
  int               rc = 0;
  char              log_buf[LOCAL_LOG_BUF_SIZE];
  int               sfds = request->rq_conn;  /* socket */

  /* Handle remote replies - local batch requests no longer create work tasks */
  if (sfds >= 0)
    {
    /* Otherwise, the reply is to be sent to a remote client */

    if (request->rq_noreply != TRUE)
      {
      rc = dis_reply_write(sfds, &request->rq_reply);

      if (LOGLEVEL >= 7)
        {
        sprintf(log_buf, "Reply sent for request type %s on socket %d",
          reqtype_to_txt(request->rq_type),
          sfds);

        log_record(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf);
        }
      }
    }

  if (((request->rq_type != PBS_BATCH_AsyModifyJob) && 
       (request->rq_type != PBS_BATCH_AsyrunJob) &&
       (request->rq_type != PBS_BATCH_AsySignalJob)) ||
      (request->rq_noreply == TRUE))
    {
    free_br(request);
    }

  return(rc);
  }  /* END reply_send_svr() */
示例#2
0
文件: reply_send.c 项目: dbeer/torque
int reply_send_mom(

  struct batch_request *request)  /* I (freed) */

  {
  int      rc = 0;
  int      sfds = request->rq_conn;  /* socket */

  /* determine where the reply should go, remote or local */

  if (sfds == PBS_LOCAL_CONNECTION)
    {
    rc = PBSE_SYSTEM;
    }
  else if (sfds >= 0)
    {
    /* Otherwise, the reply is to be sent to a remote client */
    rc = dis_reply_write(sfds, &request->rq_reply);
    }
  free_br(request);
  return(rc);
  }  /* END reply_send_mom() */
示例#3
0
int reply_send(

  struct batch_request *request)  /* I (freed) */

  {
  int      rc = 0;
  int      sfds = request->rq_conn;  /* socket */

#ifndef PBS_MOM
  static char    *id = "reply_send";

  struct work_task *ptask;
#endif /* PBS_MOM */

  /* determine where the reply should go, remote or local */

  if (sfds == PBS_LOCAL_CONNECTION)
    {

#ifndef PBS_MOM

    /*
     * reply stays local, find work task and move it to
     * the immediate list for dispatching.
     */

    ptask = (struct work_task *)GET_NEXT(task_list_event);

    while (ptask != NULL)
      {
      if ((ptask->wt_type == WORK_Deferred_Local) &&
          (ptask->wt_parm1 == (void *)request))
        {
        delete_link(&ptask->wt_linkall);

        append_link(&task_list_immed, &ptask->wt_linkall, ptask);

        return(0);
        }

      ptask = (struct work_task *)GET_NEXT(ptask->wt_linkall);
      }

    /* should have found a task and didn't */

    log_err(-1, id, "did not find work task for local request");

#endif /* PBS_MOM */

    rc = PBSE_SYSTEM;
    }
  else if (sfds >= 0)
    {
    /* Otherwise, the reply is to be sent to a remote client */

#ifndef PBS_MOM
    if (request->rq_noreply != TRUE)
      {
#endif
      rc = dis_reply_write(sfds, &request->rq_reply);
#ifndef PBS_MOM
      if (LOGLEVEL >= 7)
        {
        sprintf(log_buffer, "Reply sent for request type %s on socket %d",
          reqtype_to_txt(request->rq_type),
          sfds);

        log_record(
          PBSEVENT_JOB,
          PBS_EVENTCLASS_JOB,
          id,
          log_buffer);
        }
#ifndef PBS_MOM
      }

#endif
#endif
    }

#ifndef PBS_MOM
  if ((request->rq_type != PBS_BATCH_AsyModifyJob) || (request->rq_noreply == TRUE))
    {
#endif
    free_br(request);
#ifndef PBS_MOM
    }

#endif

  return(rc);
  }  /* END reply_send() */