コード例 #1
0
ファイル: iostream.c プロジェクト: aleeehaider825/hachi-roku
static int
_iostream_wait (struct _mu_stream *str, int *pflags, struct timeval *tvp)
{
  struct _mu_iostream *sp = (struct _mu_iostream *)str;
  int rc = EINVAL;
  
  if (*pflags == MU_STREAM_READY_RD)
    {
      rc = mu_stream_wait (sp->transport[_MU_STREAM_INPUT], pflags, tvp);
      if (rc)
	sp->last_err_str = _MU_STREAM_INPUT;
    }
  else if (*pflags == MU_STREAM_READY_WR)
    {
      rc = mu_stream_wait (sp->transport[_MU_STREAM_OUTPUT], pflags, tvp);
      if (rc)
	sp->last_err_str = _MU_STREAM_OUTPUT;
    }
  return rc;
}
コード例 #2
0
ファイル: stream.c プロジェクト: aleeehaider825/hachi-roku
static PyObject *
api_stream_wait (PyObject *self, PyObject *args)
{
  int status, wflags;
  PyStream *py_stm;

  if (!PyArg_ParseTuple (args, "O!i", &PyStreamType, &py_stm, &wflags))
    return NULL;

  status = mu_stream_wait (py_stm->stm, &wflags, NULL);
  return _ro (PyInt_FromLong (status));
}
コード例 #3
0
int
mu_pop3_carrier_is_ready (mu_stream_t carrier, int flag, int timeout)
{
  struct timeval tv, *tvp = NULL;
  int wflags = flag;
  int status;
  
  if (timeout >= 0)
    {
      tv.tv_sec  = timeout / 100;
      tv.tv_usec = (timeout % 1000) * 1000;
      tvp = &tv;
    }
  status = mu_stream_wait (carrier, &wflags, tvp);
  if (status)
    return 0; /* FIXME: provide a way to return error code! */
  return wflags & flag;
}
コード例 #4
0
ファイル: io.c プロジェクト: aleeehaider825/hachi-roku
/* Wait TIMEOUT seconds for data on the input stream.
   Returns 0   if no data available
           1   if some data is available
	   -1  an error occurred */
int
io_wait_input (int timeout)
{
  int wflags = MU_STREAM_READY_RD;
  struct timeval tv;
  int status;
  
  tv.tv_sec = timeout;
  tv.tv_usec = 0;
  status = mu_stream_wait (iostream, &wflags, &tv);
  if (status)
    {
      mu_diag_output (MU_DIAG_ERROR, _("cannot poll input stream: %s"),
		      mu_strerror(status));
      return -1;
    }
  return wflags & MU_STREAM_READY_RD;
}
コード例 #5
0
ファイル: streamref.c プロジェクト: Distrotech/mailutils
static int
_streamref_wait (struct _mu_stream *str, int *pflags, struct timeval *tvp)
{
  struct _mu_streamref *sp = (struct _mu_streamref *)str;
  return streamref_return (sp, mu_stream_wait (sp->transport, pflags, tvp));
}