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

Are Bitswap Sessions actually being used? #5640

Closed
hannahhoward opened this issue Oct 25, 2018 · 8 comments · Fixed by ipfs/go-bitswap#19
Closed

Are Bitswap Sessions actually being used? #5640

hannahhoward opened this issue Oct 25, 2018 · 8 comments · Fixed by ipfs/go-bitswap#19
Assignees

Comments

@hannahhoward
Copy link
Contributor

Possible Bug

It is not clear to me that in the current go-ipfs/master along with go-bitswap/master that any code in https://github.com/ipfs/go-bitswap/blob/master/session.go#L54 is being run.

Testing with the cat command, the call stack is as follows:
-- api.Unixfs().Get()
-- api.core().getSession()
-- dag.NewSession()
-- dagService.Session()
-- blockService.NewSession()

However, here's the issue -- to call bitswap sessions you would need to satisfy the branching condition on line 117-- but you don't and instead it just returns the value at line 125

@schomatis identified this issue in discussions of ipfs/go-bitswap#8 in relation to that feature branch of go-bitswap but it appears to affect master as well. (and can't be fixed through updating go-ipfs-exhange-interface to 0.1.1 since NewSession in master in BitSwap just returns a Session struct)

Am I missing something? Or are we not getting the benefit of sessions we intend to get.

@whyrusleeping
Copy link
Member

@hannahhoward I remember noticing this while we were meeting in LA, some interface changes seem to have snuck in there and broken things. This is fixed in https://github.com/ipfs/go-bitswap/pull/8/files (and a type assertion was added to ensure we don't break this in the future).

We should probably apply that fix independently.

@schomatis
Copy link
Contributor

This is fixed in https://github.com/ipfs/go-bitswap/pull/8/files

@whyrusleeping Where? (I mean, which line?)

@schomatis
Copy link
Contributor

Oh, I understand, thanks. My original problem that @hannahhoward is citing was actually related to a version mismatch, not the interface change.

@hannahhoward
Copy link
Contributor Author

@whyrusleeping + @Stebalien I am going to work on extracting the parts of that PR (tests + that fix) that we know we want into a seperate PR we can merge right away.

@Stebalien
Copy link
Member

❤️

@whyrusleeping
Copy link
Member

@hannahhoward the way i put the commits together should make it pretty easy. I separated the 'adding tests' and the 'changing sessions' into separate commits.

@hannahhoward
Copy link
Contributor Author

Will do. I'm in TN for a conference till tomorrow but will work on this Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants