Skip to content

Commit

Permalink
message debug
Browse files Browse the repository at this point in the history
  • Loading branch information
zsfelfoldi committed Feb 12, 2015
1 parent 77ab911 commit 9c5b1db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bzz/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ func (self *bzzProtocol) handle() error {
retrieveRequestMsg // 0x03
peersMsg // 0x04
*/

switch msg.Code {
case statusMsg:
dpaLogger.Warnf("Status message: %#v", msg)
return self.protoError(ErrExtraStatusMsg, "")

case storeRequestMsg:
Expand All @@ -206,6 +208,7 @@ func (self *bzzProtocol) handle() error {
if err := msg.Decode(&req); err != nil {
return self.protoError(ErrDecode, "->msg %v: %v", msg, err)
}
dpaLogger.Warnf("Request message: %#v", req)
req.peer = peer{bzzProtocol: self}
self.netStore.addRetrieveRequest(&req)

Expand Down Expand Up @@ -275,6 +278,7 @@ func (self *bzzProtocol) handleStatus() (err error) {

// outgoing messages
func (self *bzzProtocol) retrieve(req *retrieveRequestMsgData) {
dpaLogger.Warnf("Request message: %#v", req)
p2p.EncodeMsg(self.rw, retrieveRequestMsg, req)
}

Expand Down
3 changes: 3 additions & 0 deletions p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ func (p *Peer) dispatch(msg Msg, protoDone chan struct{}) (wait bool, err error)
// optimization: msg is small enough, read all
// of it and move on to the next message
buf, err := ioutil.ReadAll(msg.Payload)
if len(buf) > 0 {
p.Warnf("Received message %x", buf)
}
if err != nil {
return false, err
}
Expand Down

0 comments on commit 9c5b1db

Please sign in to comment.