-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bitswap nits #4458
bitswap nits #4458
Conversation
Test fail on Jenkins looks unrelated:
|
d69697d
to
e985975
Compare
@@ -372,16 +372,6 @@ func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg | |||
return | |||
} | |||
|
|||
// quickly send out cancels, reduces chances of duplicate block receives | |||
var keys []*cid.Cid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whyrusleeping this code was dead. We're currently sending out cancels from within sessions. However, this does mean that the above comment is no longer correct (it'll likely take a bit longer to send out cancels).
This should hopefully make gc a bit happier when bitswapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Avoids lots of reallocations under a lock. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Also, don't call time.Now in a loop. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
e985975
to
93151d4
Compare
@@ -336,12 +337,12 @@ func (e *Engine) numBytesReceivedFrom(p peer.ID) uint64 { | |||
// ledger lazily instantiates a ledger | |||
func (e *Engine) findOrCreate(p peer.ID) *ledger { | |||
e.lock.Lock() | |||
defer e.lock.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do want to note that this may cause a perf degradation
No description provided.