Closed holgerd77 closed 4 years ago
I am not sure I can review this thoroughly today, as I need to gather context from the library and dive deep. Will schedule it for monday. Sounds good @holgerd77?
@evertonfraga Sure, definitely, neither this here nor the forkhash
PR are too pressing.
If this could get a review today or tomorrow would be nice. Would like to slowly start to plan for a maintenance release on the client (for next week or so), and this (respectively a subsequent devp2p patch release) would be some part of it.
This PR refactors the
Peer
class from theRLPx
package.Following changes:
_onSocketData
), extract fromconstructor
codeonSocketData
functionality into separate_handleAuth
,_handleAck
functionsparsePacketContent
to separatehandleHeader
andhandleBody
functions_handleMessage
into_handleHello
,handleDisconnect
,handlePing
andhandlePong
debug
output for errors catched to not let programmatic errors slip through unnoticedSorry if this is a bit hard to review, but this class needed some major revamp to have some fresh basis here. Tests pass and I also ran the example code on this for quite some time.
I would expect that we will find pre-existing bugs and suboptimalities on having a second look on the refactored code base. Before there was just too much "spaghetti" 😛 , especially along this central data processing code (now
onSocketData
).