The fairness algorithms are not the best, not every bufferevent type is supported, and some of the locking tricks here are simply absurd. Still, this code should be a good first step.