ensure direct exit after calling back
any structures may be invalid after callback invocation. this has the side effect that the socket write callback now returns void, like all other callbacks do.
This commit is contained in:
parent
6c08f568d0
commit
02af3f4c73
|
@ -335,7 +335,7 @@ cmd_submittable( imap_store_t *ctx, struct imap_cmd *cmd )
|
|||
ctx->num_in_progress < ((imap_store_conf_t *)ctx->gen.conf)->server->max_in_progress;
|
||||
}
|
||||
|
||||
static int
|
||||
static void
|
||||
flush_imap_cmds( imap_store_t *ctx )
|
||||
{
|
||||
struct imap_cmd *cmd;
|
||||
|
@ -345,7 +345,6 @@ flush_imap_cmds( imap_store_t *ctx )
|
|||
ctx->pending_append = &ctx->pending;
|
||||
send_imap_cmd( ctx, cmd );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1589,7 +1588,7 @@ imap_open_store( store_conf_t *conf, const char *label,
|
|||
|
||||
socket_init( &ctx->conn, &srvc->sconf,
|
||||
(void (*)( void * ))imap_invoke_bad_callback,
|
||||
imap_socket_read, (int (*)(void *))flush_imap_cmds, ctx );
|
||||
imap_socket_read, (void (*)(void *))flush_imap_cmds, ctx );
|
||||
socket_connect( &ctx->conn, imap_open_store_connected );
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ ssl_return( const char *func, conn_t *conn, int ret )
|
|||
/* Callers take the short path out, so signal higher layers from here. */
|
||||
conn->state = SCK_EOF;
|
||||
conn->read_callback( conn->callback_aux );
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
sys_error( "Socket error: secure %s %s", func, conn->name );
|
||||
} else {
|
||||
|
@ -766,7 +766,8 @@ do_queued_write( conn_t *conn )
|
|||
conf_wakeup( &conn->ssl_fake, 0 );
|
||||
#endif
|
||||
conn->writing = 0;
|
||||
return conn->write_callback( conn->callback_aux );
|
||||
conn->write_callback( conn->callback_aux );
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -88,7 +88,7 @@ typedef struct {
|
|||
|
||||
void (*bad_callback)( void *aux ); /* async fail while sending or listening */
|
||||
void (*read_callback)( void *aux ); /* data available for reading */
|
||||
int (*write_callback)( void *aux ); /* all *queued* data was sent */
|
||||
void (*write_callback)( void *aux ); /* all *queued* data was sent */
|
||||
union {
|
||||
void (*connect)( int ok, void *aux );
|
||||
void (*starttls)( int ok, void *aux );
|
||||
|
@ -123,7 +123,7 @@ static INLINE void socket_init( conn_t *conn,
|
|||
const server_conf_t *conf,
|
||||
void (*bad_callback)( void *aux ),
|
||||
void (*read_callback)( void *aux ),
|
||||
int (*write_callback)( void *aux ),
|
||||
void (*write_callback)( void *aux ),
|
||||
void *aux )
|
||||
{
|
||||
conn->conf = conf;
|
||||
|
|
Loading…
Reference in New Issue
Block a user