
The same operations of protocol state and inspections of the buffer were done in multiple places. Combining these into one function removes the duplicated code.
The same operations of protocol state and inspections of the buffer were done in multiple places. Combining these into one function removes the duplicated code.