commit c391b06b07ec6310fbce1759c4a2d85bb0027c98
parent 6010fe104ef2a3e91335fdb7e686939d6af82a46
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Sat, 16 Nov 2019 16:00:06 +0100
drop redundant conn->writing member
this information is already encoded in the socket notifier's config.
Diffstat:
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/common.h b/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 {
diff --git a/src/socket.c b/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 );
}
diff --git a/src/socket.h b/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
diff --git a/src/util.c b/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 )
{