-
-
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
Add latency and bandwidth options to mocknet #1431
Conversation
There were the following issues with your Pull Request
Guidelines are available to help. Your feedback on GitCop is welcome on this issue This message was auto-generated by https://gitcop.com |
@@ -460,7 +462,7 @@ func TestAdding(t *testing.T) { | |||
if h1 == nil { | |||
t.Fatalf("no network for %s", p1) | |||
} | |||
|
|||
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.
you'll want to make sure to run go fmt
-- http://tip.golang.org/misc/git/pre-commit
@Heems let's drop the extra "remove junk" commits. will want to just "squash" them into the first. take a look at: https://github.com/ipfs/community/blob/master/docs/amending-commits.md and spend a bit of time playing with |
@whyrusleeping want to CR this? |
Right, sorry. I squashed the extra commits, added the signoff, and ran go fmt. |
@Heems did you have issues trying out my feat/netsim branch? If so, i can help out on that end. Doing latency this way is going to cause headaches |
We decided that it would be faster/easier to do it this way for now, since it'd probably take me a lot longer to understand how netsim and mocknet work and figure out what's needed to use netsim as a testnet and control which peers can communicate. The plan was to add realism as we need it, but if this way of adding latency won't work, then I can definitely try to use netsim. What is the problem with this approach? Would it be enough to incorporate the logic from netsim's If it isn't salvagable, is netsim at the point where I would just be able to wrap it in its on testnet struct (like an alternate peernet) and be able to use it with bitswap? One specific question I had was the usage of the Thanks |
netsim was designed as a drop-in replacement for the current mocknet. It provides a very similar interface and the same functionality. I'll rebase and show you how it would integrate into your PR. |
although, if you want, you could just integrate the transport logic into mocknet. The other functionality that netsim adds is the ability to dial peers over the 'network' by their peer ID |
@whyrusleeping i wonder if it makes sense to break out mocknet into its own package. |
@jbenet i like the idea, although it might be difficult to do without also breaking out all of our networking layer into a separate package(s) |
@Heems alright, i pulled down your bssim code, and it looks like you could integrate netsim into it by replacing your usage of mocknet in |
@Heems give it a try, if it's not too straightforward, we can always punt, handle the more interesting stuff first, and circle back later. |
There were the following issues with your Pull Request
Guidelines are available to help. Your feedback on GitCop is welcome on this issue This message was auto-generated by https://gitcop.com |
1 similar comment
There were the following issues with your Pull Request
Guidelines are available to help. Your feedback on GitCop is welcome on this issue This message was auto-generated by https://gitcop.com |
There were the following issues with your Pull Request
Guidelines are available to help. Your feedback on GitCop is welcome on this issue This message was auto-generated by https://gitcop.com |
@Heems closed? |
This PR adds an optional bandwidth cap and latency to the mocknet.
Bandwidth is limited using a
ratelimiter
object. It uses the token bucket algorithm to determine how long to wait before sending data. Latency and rate limiting are applied on stream writes.I use the existing LinkOptions struct for configuration.