-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Export StreamComplement/ConnComplement convenience functions. * Make the TestNotifications test pass reliably, even when we have a bunch of streams (identify, etc.). * Make the mock net order disconnect events after connect events. * Make closing one side of a connection actually close both sides. * Make it possible to extract a mock stream's complement. * Fire remote events at the same time as the local events.
- Loading branch information
Showing
6 changed files
with
161 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package mocknet | ||
|
||
import ( | ||
"github.com/libp2p/go-libp2p-core/network" | ||
) | ||
|
||
// StreamComplement returns the other end of the given stream. This function | ||
// panics when passed a non-mocknet stream. | ||
func StreamComplement(s network.Stream) network.Stream { | ||
return s.(*stream).rstream | ||
} | ||
|
||
// ConnComplement returns the other end of the given connection. This function | ||
// panics when passed a non-mocknet connection. | ||
func ConnComplement(c network.Conn) network.Conn { | ||
return c.(*conn).rconn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.