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

Add websocket transport to transit relay #40

Merged
merged 13 commits into from
Mar 20, 2022

Conversation

c-chroniko
Copy link

Cherry-picked commits from psanford#63


Code Review Checklist (to be filled out by reviewer)

  • Description accurately reflects what changes are being made.
  • Description explains why the changes are being made (or references an issue containing one).
  • The PR appropriately sized.
  • New code has enough tests.
  • New code has enough documentation to answer "how do I use it?" and "what does it do?".
  • Existing documentation is up-to-date, if impacted.

@vu3rdd vu3rdd self-requested a review January 11, 2022 15:43
Copy link

@vu3rdd vu3rdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess some rework is necessary for the tests to make it compile with the API changes in our current code.

relayServer := newTestTCPRelayServer()
defer relayServer.close()
testDisableLocalListener = true
defer func() { testDisableLocalListener = false }()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not work anymore on our master as we removed this global variable in 66d2eb9.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this code be updated to use t.disableListener, reverted to the old revision, removed entirely... I see lines 250-254 preserves the old code so I assume we can just undo this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh never mind, functions such as Receive() set that already. So I guess that leaves the question, do we want the old relayServer assignment and deferment?

if err != nil {
t.Fatal(err)
}
receiver, err := c1.Receive(ctx, code)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Receive() now takes 3 parameters. So this would not compile in the current form.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want disableListener parameter true or false here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want disableListener as false for those tests that just use relay and not transfer from client to client.

},
}
testDisableLocalListener = true
defer func() { testDisableLocalListener = false }()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above. This global has been removed.

t.Fatal(err)
}
// skip th wrapper so we can provide our own offer
code, _, err := c0.sendFileDirectory(ctx, offer, r)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendFileDirectory() also takes an extra param now.

if err != nil {
t.Fatal(err)
}
receiver, err := c1.Receive(ctx, code)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment here as above on Receive()

@vu3rdd
Copy link

vu3rdd commented Feb 1, 2022

Suggest doing a build and run the test and try to fix those errors to make it build/test. go test ./... at the home directory of the source code should throw a bunch of errors. Now, if you fix those not enough in call to foobar and choose true or false depending on whether we need to listen or not (if testDisableLocalListener is true, then we are going to use our test relay server in the test code, so we pass disableListener parameter as true).

c-chroniko and others added 9 commits February 4, 2022 04:54
Client.SendFile, Client.Receive, and other functions now require a
disableListener parameter. This replaces the global
testDisableLocalListener.
Client.SendFile, Client.Receive, and other functions now require a
disableListener parameter. This replaces the global
testDisableLocalListener.
TestPendingSendCancelable and TestPendingRecvCancelable tests do not
complete before 10 minute timeout, so disable/remove these tests for
now.
Copy link

@vu3rdd vu3rdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. 👍 Please leave out those four snippets of code and merge. Thanks!

wormhole/file_transport.go Outdated Show resolved Hide resolved
wormhole/file_transport.go Outdated Show resolved Hide resolved
wormhole/file_transport.go Outdated Show resolved Hide resolved
@c-chroniko c-chroniko merged commit 6c577b4 into LeastAuthority:master Mar 20, 2022
JustusFT pushed a commit that referenced this pull request Aug 18, 2022
Canceling the context will now cancel an in-flight file transfer.
This should cover most cases. There might still be some edge cases
where cancellation doesn't work.

Closes: #40 [via git-merge-pr]
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 this pull request may close these issues.

3 participants