/*
* Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright (c) 2007-2010 Niels Provos, Nick Mathewson
+ * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "evbuffer-internal.h"
#include "util-internal.h"
+static void _bufferevent_cancel_all(struct bufferevent *bev);
+
+
void
bufferevent_suspend_read(struct bufferevent *bufev, bufferevent_suspend_flags what)
{
{
BEV_LOCK(bufev);
bufferevent_setcb(bufev, NULL, NULL, NULL, NULL);
+ _bufferevent_cancel_all(bufev);
_bufferevent_decref_and_unlock(bufev);
}
return (res<0) ? -1 : d.fd;
}
+static void
+_bufferevent_cancel_all(struct bufferevent *bev)
+{
+ union bufferevent_ctrl_data d;
+ memset(&d, 0, sizeof(d));
+ BEV_LOCK(bev);
+ if (bev->be_ops->ctrl)
+ bev->be_ops->ctrl(bev, BEV_CTRL_CANCEL_ALL, &d);
+ BEV_UNLOCK(bev);
+}
+
short
bufferevent_get_enabled(struct bufferevent *bufev)
{