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 986 of file gnutls.c.
987{
989 if (!data)
990 return -1;
991
992 if (gnutls_record_check_pending(data->
state))
993 return 1;
994
996}
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 324 of file raw.c.
325{
327 return -1;
328
329 fd_set rfds;
330 struct timeval tv;
331
332 uint64_t wait_millis = wait_secs * 1000UL;
333
334 while (true)
335 {
336 tv.tv_sec = wait_millis / 1000;
337 tv.tv_usec = (wait_millis % 1000) * 1000;
338
339 FD_ZERO(&rfds);
340 FD_SET(conn->
fd, &rfds);
341
343 const int rc = select(conn->
fd + 1, &rfds, NULL, NULL, &tv);
345
346 if ((rc > 0) || ((rc < 0) && (errno != EINTR)))
347 return rc;
348
351
352 wait_millis += pre_t;
353 if (wait_millis <= post_t)
354 return 0;
355 wait_millis -= post_t;
356 }
357}
void mutt_query_exit(void)
Ask the user if they want to leave NeoMutt.
uint64_t mutt_date_epoch_ms(void)
Return the number of milliseconds since the Unix epoch.
SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
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 577 of file sasl.c.
578{
580 int rc;
581
583 rc = sasldata->
poll(conn, wait_secs);
585
586 return rc;
587}
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 187 of file tunnel.c.
188{
190 int ofd;
191 int rc;
192
197
198 return rc;
199}
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) |