rename socket_expect_read() => socket_expect_activity()

... to better reflect its (mostly new) function.
This commit is contained in:
Oswald Buddenhagen 2019-11-16 17:14:57 +01:00
parent 8a03651dd8
commit e7bc402d09
3 changed files with 14 additions and 14 deletions

View File

@ -345,7 +345,7 @@ send_imap_cmd( imap_store_t *ctx, imap_cmd_t *cmd )
*ctx->in_progress_append = cmd;
ctx->in_progress_append = &cmd->next;
ctx->num_in_progress++;
socket_expect_read( &ctx->conn, 1 );
socket_expect_activity( &ctx->conn, 1 );
}
static int
@ -409,7 +409,7 @@ cancel_sent_imap_cmds( imap_store_t *ctx )
{
imap_cmd_t *cmd;
socket_expect_read( &ctx->conn, 0 );
socket_expect_activity( &ctx->conn, 0 );
while ((cmd = ctx->in_progress)) {
ctx->in_progress = cmd->next;
/* don't update num_in_progress and in_progress_append - store is dead */
@ -1469,7 +1469,7 @@ imap_socket_read( void *aux )
error( "IMAP error: unexpected reply: %s %s\n", arg, cmd ? cmd : "" );
break; /* this may mean anything, so prefer not to spam the log */
} else if (*arg == '+') {
socket_expect_read( &ctx->conn, 0 );
socket_expect_activity( &ctx->conn, 0 );
/* There can be any number of commands in flight, but only the last
* one can require a continuation, as it enforces a round-trip. */
cmdp = (imap_cmd_t *)((char *)ctx->in_progress_append -
@ -1499,7 +1499,7 @@ imap_socket_read( void *aux )
error( "IMAP error: unexpected command continuation request\n" );
break;
}
socket_expect_read( &ctx->conn, 1 );
socket_expect_activity( &ctx->conn, 1 );
} else {
tag = atoi( arg );
for (pcmdp = &ctx->in_progress; (cmdp = *pcmdp); pcmdp = &cmdp->next)
@ -1511,7 +1511,7 @@ imap_socket_read( void *aux )
if (!(*pcmdp = cmdp->next))
ctx->in_progress_append = pcmdp;
if (!--ctx->num_in_progress)
socket_expect_read( &ctx->conn, 0 );
socket_expect_activity( &ctx->conn, 0 );
arg = next_arg( &cmd );
if (!arg) {
error( "IMAP error: malformed tagged response\n" );
@ -1798,7 +1798,7 @@ imap_open_store_connected( int ok, void *aux )
socket_start_tls( &ctx->conn, imap_open_store_tlsstarted1 );
#endif
else
socket_expect_read( &ctx->conn, 1 );
socket_expect_activity( &ctx->conn, 1 );
}
#ifdef HAVE_LIBSSL
@ -1810,14 +1810,14 @@ imap_open_store_tlsstarted1( int ok, void *aux )
if (!ok)
imap_open_store_ssl_bail( ctx );
else
socket_expect_read( &ctx->conn, 1 );
socket_expect_activity( &ctx->conn, 1 );
}
#endif
static void
imap_open_store_greeted( imap_store_t *ctx )
{
socket_expect_read( &ctx->conn, 0 );
socket_expect_activity( &ctx->conn, 0 );
if (!ctx->caps)
imap_exec( ctx, 0, imap_open_store_p2, "CAPABILITY" );
else

View File

@ -329,7 +329,7 @@ socket_start_tls( conn_t *conn, void (*cb)( int ok, void *aux ) )
return;
}
SSL_set_mode( conn->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER );
socket_expect_read( conn, 1 );
socket_expect_activity( conn, 1 );
start_tls_p2( conn );
}
@ -348,7 +348,7 @@ start_tls_p2( conn_t *conn )
static void start_tls_p3( conn_t *conn, int ok )
{
socket_expect_read( conn, 0 );
socket_expect_activity( conn, 0 );
conn->state = SCK_READY;
conn->callbacks.starttls( ok, conn->callback_aux );
}
@ -578,7 +578,7 @@ socket_connect_one( conn_t *sock )
return;
}
conf_notifier( &sock->notify, 0, POLLOUT );
socket_expect_read( sock, 1 );
socket_expect_activity( sock, 1 );
sock->state = SCK_CONNECTING;
info( "\v\n" );
return;
@ -612,7 +612,7 @@ socket_connected( conn_t *conn )
conn->addrs = 0;
}
conf_notifier( &conn->notify, 0, POLLIN );
socket_expect_read( conn, 0 );
socket_expect_activity( conn, 0 );
conn->state = SCK_READY;
conn->callbacks.connect( 1, conn->callback_aux );
}
@ -772,7 +772,7 @@ socket_fill( conn_t *sock )
}
void
socket_expect_read( conn_t *conn, int expect )
socket_expect_activity( conn_t *conn, int expect )
{
if (conn->conf->timeout > 0 && expect != pending_wakeup( &conn->fd_timeout ))
conf_wakeup( &conn->fd_timeout, expect ? conn->conf->timeout : -1 );

View File

@ -140,7 +140,7 @@ void socket_connect( conn_t *conn, void (*cb)( int ok, void *aux ) );
void socket_start_tls(conn_t *conn, void (*cb)( int ok, void *aux ) );
void socket_start_deflate( conn_t *conn );
void socket_close( conn_t *sock );
void socket_expect_read( conn_t *sock, int expect );
void socket_expect_activity( conn_t *sock, int expect );
int socket_read( conn_t *sock, char *buf, int len ); /* never waits */
char *socket_read_line( conn_t *sock ); /* don't free return value; never waits */
typedef enum { KeepOwn = 0, GiveOwn } ownership_t;