This obviates the need for BEV_SUSPEND_CONNECTING, and good riddance.
#define BEV_SUSPEND_BW 0x02
/* On a base bufferevent: when we have emptied the group's bandwidth bucket. */
#define BEV_SUSPEND_BW_GROUP 0x04
-/* On a socket bufferevent: we aren't going to try reading until the
- * connect operation is done. */
-#define BEV_SUSPEND_CONNECTING 0x08
struct bufferevent_rate_limit_group {
/** List of all members in the group */
if (bev_ssl->write_blocked_on_read)
return;
while ((bev_ssl->bev.bev.enabled & EV_READ) &&
+ (! bev_ssl->bev.read_suspended) &&
(! wm->high || evbuffer_get_length(input) < wm->high)) {
int n_to_read =
wm->high ? wm->high - evbuffer_get_length(input)
wm = &bev_ssl->underlying->wm_write;
}
while ((bev_ssl->bev.bev.enabled & EV_WRITE) &&
+ (! bev_ssl->bev.write_suspended) &&
evbuffer_get_length(output) &&
(!target || (! wm->high || evbuffer_get_length(target) < wm->high))) {
int n_to_write;
goto done;
} else {
connected = 1;
- bufferevent_unsuspend_read(bufev, BEV_SUSPEND_CONNECTING);
#ifdef WIN32
if (BEV_IS_ASYNC(bufev)) {
event_del(&bufev->ev_write);
if (ownfd)
EVUTIL_CLOSESOCKET(fd);
/* do something about the error? */
-
done:
- if (result == 0)
- bufferevent_suspend_read(bev, BEV_SUSPEND_CONNECTING);
-
_bufferevent_decref_and_unlock(bev);
return result;
}
EV_READ|EV_PERSIST, bufferevent_readcb, bufev);
event_assign(&bufev->ev_write, bufev->ev_base, fd,
EV_WRITE|EV_PERSIST, bufferevent_writecb, bufev);
+
+ if (fd >= 0)
+ bufferevent_enable(bufev, bufev->enabled);
+
BEV_UNLOCK(bufev);
}