Check whether a socket read would block.
More...
Check whether a socket read would block.
- Parameters
-
conn | Connection to a server |
wait_secs | How long to wait for a response |
- Return values
-
>0 | There is data to read |
0 | Read would block |
-1 | Connection doesn't support polling |
◆ tls_socket_poll()
static int tls_socket_poll |
( |
struct Connection * |
conn, |
|
|
time_t |
wait_secs |
|
) |
| |
|
static |
Check whether a socket read would block - Implements Connection::poll() -.
Definition at line 983 of file gnutls.c.
984{
986 if (!data)
987 return -1;
988
989 if (gnutls_record_check_pending(data->
session))
990 return 1;
991
993}
int raw_socket_poll(struct Connection *conn, time_t wait_secs)
Checks whether reads would block - Implements Connection::poll() -.
void * sockdata
Backend-specific socket data.
◆ ssl_socket_poll()
static int ssl_socket_poll |
( |
struct Connection * |
conn, |
|
|
time_t |
wait_secs |
|
) |
| |
|
static |
Check whether a socket read would block - Implements Connection::poll() -.
Definition at line 1296 of file openssl.c.
1297{
1298 if (!conn)
1299 return -1;
1300
1301 if (SSL_has_pending(
sockdata(conn)->ssl))
1302 return 1;
1303
1305}
static struct SslSockData * sockdata(struct Connection *conn)
Get a Connection's socket data.
◆ raw_socket_poll()
int raw_socket_poll |
( |
struct Connection * |
conn, |
|
|
time_t |
wait_secs |
|
) |
| |
Checks whether reads would block - Implements Connection::poll() -.
Definition at line 340 of file raw.c.
341{
343 return -1;
344
345 fd_set rfds;
346 struct timeval tv;
347
348 uint64_t wait_millis = wait_secs * 1000UL;
349
350 while (true)
351 {
352 tv.tv_sec = wait_millis / 1000;
353 tv.tv_usec = (wait_millis % 1000) * 1000;
354
355 FD_ZERO(&rfds);
356 FD_SET(conn->
fd, &rfds);
357
359 const int rc = select(conn->
fd + 1, &rfds, NULL, NULL, &tv);
361
362 if ((rc > 0) || ((rc < 0) && (errno != EINTR)))
363 return rc;
364
367
368 wait_millis += pre_t;
369 if (wait_millis <= post_t)
370 return 0;
371 wait_millis -= post_t;
372 }
373}
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
int fd
Socket file descriptor.
◆ mutt_sasl_conn_poll()
static int mutt_sasl_conn_poll |
( |
struct Connection * |
conn, |
|
|
time_t |
wait_secs |
|
) |
| |
|
static |
Check an SASL connection for data - Implements Connection::poll() -.
Definition at line 581 of file sasl.c.
582{
584 int rc;
585
587 rc = sasldata->
poll(conn, wait_secs);
589
590 return rc;
591}
int(* poll)(struct Connection *conn, time_t wait_secs)
Check whether a socket read would block - Implements Connection::poll() -.
SASL authentication API -.
void * sockdata
Underlying socket data.
◆ tunnel_socket_poll()
static int tunnel_socket_poll |
( |
struct Connection * |
conn, |
|
|
time_t |
wait_secs |
|
) |
| |
|
static |
Checks whether tunnel reads would block - Implements Connection::poll() -.
Definition at line 194 of file tunnel.c.
195{
197 int ofd;
198 int rc;
199
204
205 return rc;
206}
A network tunnel (pair of sockets)
int fd_read
File descriptor to read from.
◆ zstrm_poll()
static int zstrm_poll |
( |
struct Connection * |
conn, |
|
|
time_t |
wait_secs |
|
) |
| |
|
static |
Checks whether reads would block - Implements Connection::poll() -.
Definition at line 211 of file zstrm.c.
212{
214
217 "last read wrote full buffer" :
218 "falling back on next stream");
219 if ((zctx->
read.
z.avail_out == 0) || (zctx->
read.
pos > 0))
220 return 1;
221
223}
#define mutt_debug(LEVEL,...)
@ LL_DEBUG5
Log at debug level 5.
int(* poll)(struct Connection *conn, time_t wait_secs)
struct ZstrmDirection read
Data being read and de-compressed.
struct Connection next_conn
Underlying stream.
unsigned int pos
Current position.
z_stream z
zlib compression handle
◆ poll
int(* SaslSockData::poll) (struct Connection *conn, time_t wait_secs) |