private PendingWrite CreatePendingBufferWrite(IActorRef commander, ByteString data, Tcp.Event ack, Tcp.WriteCommand tail) { var buffer = _tcp.BufferPool.Acquire(); try { var copied = data.CopyToBuffer(buffer); buffer.Flip(); return(new PendingBufferWrite(this, commander, data.Drop(copied), ack, buffer, tail)); } catch (Exception) { _tcp.BufferPool.Release(buffer); throw; } }