Browse Source

drop redundant conn->writing member

this information is already encoded in the socket notifier's config.
1.4
Oswald Buddenhagen 5 years ago
parent
commit
c391b06b07
  1. 1
      src/common.h
  2. 4
      src/socket.c
  3. 1
      src/socket.h
  4. 10
      src/util.c

1
src/common.h

@ -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 {

4
src/socket.c

@ -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 );
}

1
src/socket.h

@ -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

10
src/util.c

@ -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 )
{

Loading…
Cancel
Save