-
Notifications
You must be signed in to change notification settings - Fork 446
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
fix: WebTransport stream now extends abstract stream #2514
Conversation
The PR pulls all of the non-`@fails/webtransport` parts out of There's a lot of work that's been done to re-use existing libp2p code such as the abstract stream class which handles a lot more closing scenarios than the existing implementation so it would be good to get that in.
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.
I'm not gonna pretend like my review is good enough to validate much, but I left some comments
if (!existsSync('./go-libp2p-webtransport-server/main')) { | ||
await new Promise((resolve, reject) => { | ||
exec('go build -o main main.go', | ||
exec(`go build -o ${main} main.go`, |
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.
I don't think these build files are being cleaned by npm run clean
, which they probably should be
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.
TBH I want to remove this transport server entirely and just rely on precomplied binaries in the interop tests because they exercise more functionality which gives us more certainty and we don't need to be recompiling this unchanging go script over and over again.
if (result.done) { | ||
init.log('remote closed write') | ||
return | ||
} | ||
|
||
async closeWrite (options?: AbortOptions) { | ||
if (!writerClosed) { | ||
writerClosed = true | ||
if (result.value != null) { | ||
this.sourcePush(new Uint8ArrayList(result.value)) | ||
} |
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.
Can value exist and the read be done? we should check for value first.
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.
Not exactly - if value
exists and done
is false, then value
is the return value of the iterator, not a final value from the sequence.
See the iterator protocol docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
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.
ah. then i've incorrectly implemented iterators previously, or consumed some incorrectly implemented ones, because i've seen a sequence value and a done=true... good to know that's not a correct implementation.
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.
😬
The PR pulls all of the non-
@fails/webtransport
parts out of #2422There's a lot of work that's been done to re-use existing libp2p code such as the abstract stream class which handles a lot more closing scenarios than the existing implementation so it would be good to get that in.
Change checklist