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 987 of file gnutls.c.
988{
990 if (!data)
991 return -1;
992
993 if (gnutls_record_check_pending(data->
session))
994 return 1;
995
997}
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 1297 of file openssl.c.
1298{
1299 if (!conn)
1300 return -1;
1301
1302 if (SSL_has_pending(
sockdata(conn)->ssl))
1303 return 1;
1304
1306}
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 341 of file raw.c.
342{
344 return -1;
345
346 fd_set rfds;
347 struct timeval tv;
348
349 uint64_t wait_millis = wait_secs * 1000UL;
350
351 while (true)
352 {
353 tv.tv_sec = wait_millis / 1000;
354 tv.tv_usec = (wait_millis % 1000) * 1000;
355
356 FD_ZERO(&rfds);
357 FD_SET(conn->
fd, &rfds);
358
360 const int rc = select(conn->
fd + 1, &rfds, NULL, NULL, &tv);
362
363 if ((rc > 0) || ((rc < 0) && (errno != EINTR)))
364 return rc;
365
368
369 wait_millis += pre_t;
370 if (wait_millis <= post_t)
371 return 0;
372 wait_millis -= post_t;
373 }
374}
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 583 of file sasl.c.
584{
586 int rc;
587
589 rc = sasldata->
poll(conn, wait_secs);
591
592 return rc;
593}
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 195 of file tunnel.c.
196{
198 int ofd;
199 int rc;
200
205
206 return rc;
207}
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) |