This gets rid of some non-type safe string comparisons and access to members that are implementation details of class P2PConnection(asyncore.dispatcher). Such refactoring is required to replace the deprecated asyncore with something more sane.
Changes:
- Get rid of non-enum member
stateand replace is with boolconnected - Get rid of confusing argument
pushbufand literally just push to the buffer at the call site