Unless I'm mistaken, you're going to have issues here.  Now that you can have multiple threads in this code simultaneously (for different clients), you're going to risk having them use this buffer at the same time.