drop redundant conn->writing member

this information is already encoded in the socket notifier's config.
This commit is contained in:
Oswald Buddenhagen 2019-11-16 16:00:06 +01:00
parent 6010fe104e
commit c391b06b07
4 changed files with 12 additions and 4 deletions

View File

@ -235,6 +235,7 @@ typedef struct notifier {
void init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux );
void conf_notifier( notifier_t *sn, short and_events, short or_events );
short notifier_config( notifier_t *sn );
void wipe_notifier( notifier_t *sn );
typedef struct {

View File

@ -884,7 +884,6 @@ do_queued_write( conn_t *conn )
return -1;
if (n != (int)len) {
conn->write_offset += (uint)n;
conn->writing = 1;
return 0;
}
conn->write_offset = 0;
@ -894,7 +893,6 @@ do_queued_write( conn_t *conn )
if (conn->ssl && SSL_pending( conn->ssl ))
conf_wakeup( &conn->ssl_fake, 0 );
#endif
conn->writing = 0;
conn->write_callback( conn->callback_aux );
return -1;
}
@ -1103,7 +1101,7 @@ socket_fake_cb( void *aux )
/* Ensure that a pending write gets queued. */
do_flush( conn );
/* If no writes are ongoing, start writing now. */
if (!conn->writing)
if (!(notifier_config( &conn->notify ) & POLLOUT))
do_queued_write( conn );
}

View File

@ -103,7 +103,6 @@ typedef struct {
/* writing */
buff_chunk_t *append_buf; /* accumulating buffer */
buff_chunk_t *write_buf, **write_buf_append; /* buffer head & tail */
int writing;
#ifdef HAVE_LIBZ
uint append_avail; /* space left in accumulating buffer */
#endif

View File

@ -704,6 +704,16 @@ conf_notifier( notifier_t *sn, short and_events, short or_events )
#endif
}
short
notifier_config( notifier_t *sn )
{
#ifdef HAVE_SYS_POLL_H
return pollfds[sn->index].events;
#else
return sn->events;
#endif
}
void
wipe_notifier( notifier_t *sn )
{