]> granicus.if.org Git - libevent/commitdiff
Expose view of current rate limit as constrained by group limit
authorNick Mathewson <nickm@torproject.org>
Tue, 23 Feb 2010 05:38:30 +0000 (00:38 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 23 Feb 2010 05:38:30 +0000 (00:38 -0500)
bufferevent_ratelim.c
include/event2/bufferevent.h

index f0c687b6d079106d589493d47dcfe7a15260dbae..c624ec7b5487e027563236132f1cb2cfdcea709f 100644 (file)
@@ -727,6 +727,27 @@ bufferevent_get_write_limit(struct bufferevent *bev)
        return r;
 }
 
+ev_ssize_t
+bufferevent_get_max_to_read(struct bufferevent *bev)
+{
+       ev_ssize_t r;
+       BEV_LOCK(bev);
+       r = _bufferevent_get_read_max(BEV_UPCAST(bev));
+       BEV_UNLOCK(bev);
+       return r;
+}
+
+ev_ssize_t
+bufferevent_get_max_to_write(struct bufferevent *bev)
+{
+       ev_ssize_t r;
+       BEV_LOCK(bev);
+       r = _bufferevent_get_write_max(BEV_UPCAST(bev));
+       BEV_UNLOCK(bev);
+       return r;
+}
+
+
 /* Mostly you don't want to use this function from inside libevent;
  * _bufferevent_get_read_max() is more likely what you want*/
 ev_ssize_t
index 6c37dc0bcf94f360171455ac334cd1bd91fc61dd..18114c20d5868deee5b3244bcaa646c08bb3fd39 100644 (file)
@@ -597,6 +597,9 @@ ev_ssize_t bufferevent_get_read_limit(struct bufferevent *bev);
 ev_ssize_t bufferevent_get_write_limit(struct bufferevent *bev);
 /*@}*/
 
+ev_ssize_t bufferevent_get_max_to_read(struct bufferevent *bev);
+ev_ssize_t bufferevent_get_max_to_write(struct bufferevent *bev);
+
 /*@{*/
 /**
    Return the read or write bucket size for a bufferevent rate limit