Skip to content
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

fix: race condition when requesting the same block twice #214

Merged
merged 12 commits into from
May 27, 2020

Commits on May 19, 2020

  1. fix: race condition when requesting the same block twice

    When we call `blockstore.putMany`, some implementations will batch
    up all the `put`s and write them at once.  This means that
    `blockstore.has` might not return `true` for a little while - if
    another request for a given block comes in before `blockstore.has`
    returns `true` it'll get added to the want list.  If the block then
    finishes it's batch and finally a remote peer supplies the wanted
    block, the notifications that complete the second block request
    will never get sent and the process will hang idefinately.
    
    The change made here is to separate the sending of notifications
    out from putting things into the blockstore.  If the blockstore has
    a block, but the block is still in the wantlist, send notifications
    that we now have the block.
    achingbrain committed May 19, 2020
    Configuration menu
    Copy the full SHA
    1fc09ed View commit details
    Browse the repository at this point in the history

Commits on May 20, 2020

  1. Configuration menu
    Copy the full SHA
    fa2310e View commit details
    Browse the repository at this point in the history
  2. fix: actually really actually use bitswap 1.2.0

    We weren't using 1.2.0 in the protocol negotiation. Now we do.
    achingbrain committed May 20, 2020
    Configuration menu
    Copy the full SHA
    53c0790 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2020

  1. Configuration menu
    Copy the full SHA
    7b331ce View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b2336f View commit details
    Browse the repository at this point in the history

Commits on May 22, 2020

  1. feat: allow using abort controllers to abort block want notifications

    - Key notifications by CID multihashes so one block can service multiple wants
      if they are for the same data but requested with difference CIDs
    - Pass in an AbortSignal to notifications and that tears down only the listeners
      set up for that invocation and rejects the current promise only when aborted
    - notifications.unwant will now reject all outstanding promises for that CID
    
    A follow up commit will handle removing things from the want list.
    achingbrain committed May 22, 2020
    Configuration menu
    Copy the full SHA
    8c0ed0a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1874dc8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d5d81fc View commit details
    Browse the repository at this point in the history

Commits on May 26, 2020

  1. Configuration menu
    Copy the full SHA
    bd676f0 View commit details
    Browse the repository at this point in the history

Commits on May 27, 2020

  1. chore: update src/index.js

    Co-authored-by: dirkmc <dirkmdev@gmail.com>
    achingbrain and dirkmc authored May 27, 2020
    Configuration menu
    Copy the full SHA
    ac1e2a8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f88c55e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d17c787 View commit details
    Browse the repository at this point in the history