1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +08:00

add transport logic to mocknet

License: MIT
Signed-off-by: Karthik Bala <karthikbala444@gmail.com>
This commit is contained in:
Karthik Bala
2015-07-06 15:10:13 -07:00
parent a95ce17bd1
commit 0e597b3ae6
7 changed files with 312 additions and 15 deletions

View File

@ -46,7 +46,7 @@ func (g *SessionGenerator) Next() Instance {
if err != nil {
panic("FIXME") // TODO change signature
}
return session(g.ctx, g.net, p)
return Session(g.ctx, g.net, p)
}
func (g *SessionGenerator) Instances(n int) []Instance {
@ -85,7 +85,7 @@ func (i *Instance) SetBlockstoreLatency(t time.Duration) time.Duration {
// NB: It's easy make mistakes by providing the same peer ID to two different
// sessions. To safeguard, use the SessionGenerator to generate sessions. It's
// just a much better idea.
func session(ctx context.Context, net tn.Network, p testutil.Identity) Instance {
func Session(ctx context.Context, net tn.Network, p testutil.Identity) Instance {
bsdelay := delay.Fixed(0)
const writeCacheElems = 100