Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit e418906

Browse files
committed
Resolve merge conflicts
2 parents b599039 + 2c8da24 commit e418906

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

Godeps/Godeps.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

net/retriever/retriever.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,11 @@ func (m *MessageRetriever) fetchIPFS(pid peer.ID, n *core.IpfsNode, addr ma.Mult
246246
select {
247247
case <-c:
248248
if err != nil {
249-
log.Errorf("Error retrieving offline message from %s, %s", addr.String(), err.Error())
249+
log.Errorf("Error retrieving offline message from: %s, Error: %s", addr.String(), err.Error())
250250
return
251251
}
252-
log.Debugf("Successfully downloaded offline message from %s", addr.String())
252+
log.Debugf("Successfully downloaded offline message %s from: %s", addr.String(), pid.Pretty())
253+
253254
err = m.db.OfflineMessages().Put(addr.String())
254255
if err != nil {
255256
log.Error(err)
@@ -308,44 +309,46 @@ func (m *MessageRetriever) attemptDecrypt(ciphertext []byte, pid peer.ID, addr m
308309
// Decrypt and unmarshal plaintext
309310
plaintext, err := net.Decrypt(m.node.PrivateKey, ciphertext)
310311
if err != nil {
311-
log.Warningf("Unable to decrypt offline message from %s: %s", addr.String(), err.Error())
312+
log.Warningf("Unable to decrypt cipher text to plain text, CID: %s: Error:%s\n", addr.String(), err.Error())
312313
return
313314
}
314315

315316
// Unmarshal plaintext
316317
env := pb.Envelope{}
317318
err = proto.Unmarshal(plaintext, &env)
318319
if err != nil {
319-
log.Warningf("Unable to decrypt offline message from %s: %s", addr.String(), err.Error())
320+
log.Warningf("Unable to unmarshal plaintext to encrypted Envelope, CID: %s: Error:%s\n", addr.String(), err.Error())
320321
return
321322
}
322323

323324
// Validate the signature
324325
ser, err := proto.Marshal(env.Message)
325326
if err != nil {
326-
log.Warningf("Unable to decrypt offline message from %s: %s", addr.String(), err.Error())
327+
log.Warningf("Unable to serialize the encrypted message, CID: %s: Error:%s\n", addr.String(), err.Error())
327328
return
328329
}
329330
pubkey, err := libp2p.UnmarshalPublicKey(env.Pubkey)
330331
if err != nil {
331-
log.Warningf("Unable to decrypt offline message from %s: %s", addr.String(), err.Error())
332+
log.Warningf("Unable to unmarshal the public key from, CID: %s: Error:%s\n", addr.String(), err.Error())
332333
return
333334
}
334335

335336
valid, err := pubkey.Verify(ser, env.Signature)
336337
if err != nil || !valid {
337-
log.Warningf("Unable to decrypt offline message from %s: %s", addr.String(), err.Error())
338+
log.Warningf("Unable to verify message signature, CID: %s: Error:%s\n", addr.String(), err.Error())
338339
return
339340
}
340341

341342
id, err := peer.IDFromPublicKey(pubkey)
342343
if err != nil {
343-
log.Warningf("Unable to decrypt offline message from %s: %s", addr.String(), err.Error())
344+
log.Warningf("Unable to get a peer ID from the pubkey, CID: %s: Error:%s\n", addr.String(), err.Error())
344345
return
345346
}
346347

348+
log.Debugf("Received offline message %s from: %s\n", addr.String(), id.Pretty())
349+
347350
if m.bm.IsBanned(id) {
348-
log.Warningf("Received and dropped offline message from banned user: %s ", id.String())
351+
log.Warningf("Received and dropped offline message from banned user: %s\n", id.Pretty())
349352
return
350353
}
351354

0 commit comments

Comments
 (0)