Skip to content

Commit

Permalink
More data transfer logging (#226)
Browse files Browse the repository at this point in the history
* data-transfer logging

* data-transfer logging
  • Loading branch information
aarshkshah1992 authored Jul 29, 2021
1 parent 0a742cf commit 1d44c41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions channels/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ func (c *Channels) CreateNew(selfPeer peer.ID, tid datatransfer.TransferID, base
Status: datatransfer.Requested,
})
if err != nil {
log.Errorw("failed to create new tracking channel for data-transfer", "channelID", chid, "err", err)
return datatransfer.ChannelID{}, err
}
log.Debugw("created tracking channel for data-transfer, emitting channel Open event", "channelID", chid)
return chid, c.stateMachines.Send(chid, datatransfer.Open)
}

Expand Down
3 changes: 3 additions & 0 deletions impl/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,13 @@ func (m *manager) acceptRequest(chid datatransfer.ChannelID, incoming datatransf
dataReceiver = m.peerID
}

log.Infow("data-transfer request validated, will create & start tracking channel", "channelID", chid, "payloadCid", incoming.BaseCid())
_, err = m.channels.CreateNew(m.peerID, incoming.TransferID(), incoming.BaseCid(), stor, voucher, chid.Initiator, dataSender, dataReceiver)
if err != nil {
log.Errorw("failed to create and start tracking channel", "channelID", chid, "err", err)
return result, err
}
log.Debugw("successfully created and started tracking channel", "channelID", chid)
if result != nil {
err := m.channels.NewVoucherResult(chid, result)
if err != nil {
Expand Down

0 comments on commit 1d44c41

Please sign in to comment.