[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] How to limit the read/write( input/output ) traffic?



Hi, all
    I want to shape the read/write traffic, I check the data-structure
    I find there are 4 members in the struct bufferevent which maybe do that function.
    However I don't know how to do it in detail steps.
    Anyone can share some tips for that?


struct bufferevent {
    ......

    /** An input buffer. Only the bufferevent is allowed to add data to
        this buffer, though the user is allowed to drain it. */
    struct evbuffer *input;

    /** An input buffer. Only the bufferevent is allowed to drain data
        from this buffer, though the user is allowed to add it. */
    struct evbuffer *output;

    struct event_watermark wm_read;
    struct event_watermark wm_write;

};

--
     _                         __ _     _
 ___| |__   ___ _ __   __ _   / _(_)___| |__
|_  / '_ \ / _ \ '_ \ / _` | | |_| / __| '_ \
 / /| | | |  __/ | | | (_| | |  _| \__ \ | | |
/___|_| |_|\___|_| |_|\__, | |_| |_|___/_| |_|
                      |___/