Beispiel #1
0
    void Connection::onErrorStatic( bufferevent* bev, short error, void* ctx )
    {
        if ( !bufferevent_get_enabled( bev ) )
        {
            return;
        }

        (( Connection* ) ctx)->onError( error );
    }
Beispiel #2
0
 bool Connection::enabled()
 {
     if ( bufferevent_get_enabled( m_handle ) == 0 )
     {
         return false;
     }
     
     return true;
     
 }
void bev_disconnect(struct bufferevent* bev)
{
	// close bufferevent
	if(bev != NULL) {
		short enabled = bufferevent_get_enabled(bev);
		if(EV_READ & enabled)
			bufferevent_disable(bev, EV_READ);
		if(EV_WRITE & enabled)
			bufferevent_disable(bev, EV_WRITE);
		bufferevent_free(bev);
		bev = NULL;
	}
}
Beispiel #4
0
/**
 * @brief pauses a connection (disables reading)
 *
 * @param c a evhtp_connection_t * structure
 */
void
evhtp_connection_pause(evhtp_connection_t * c) {
    if ((bufferevent_get_enabled(c->bev) & EV_READ)) {
        bufferevent_disable(c->bev, EV_READ);
    }
}