If a result consists of only OK packets, they would be processed
recursively which most of the time leads to a stack overflow. This can be
prevented by consuming all OK packets in the result in one go.
By splitting the processing and state querying into two separate
functions, the result can be inspected multiple times without triggering
the result processing.