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

Update relay_pool_impl to support EOSE,OK, NOTICE #3

Merged
merged 3 commits into from
Aug 27, 2023

Conversation

jrlwazo
Copy link
Contributor

@jrlwazo jrlwazo commented Aug 21, 2023

Currently, when using a relay pool, It only adds EVENT to the stream.

This add support for other message types

@aniketambore
Copy link
Owner

Hi @jrlwazo , Thank you for your PR! I appreciate your effort in improving the RelayPool class, expanding the functionality to support other message types besides EVENT. Great!

However, I have a few comments on specific code portions that I'd like you to address:

  1. In the code block:
   if (_channels.every((c) => (c.closeCode != null &&
                c.closeCode != 1000 &&
                c.closeCode != 1005))) {

It seems you've added additional conditions for closeCode . Previously, I was only checking for closeCode != null . Could you please provide some context on why these specific codes (1000 and 1005) are excluded? Adding comments explaining the rationale behind these changes would be helpful.

In this code block:

if (channel.closeCode == null) {
     channel.sink.close(status.goingAway);
} else {
     continue;
}

The previous code simply closed the channel using channel.sink.close();. Could you provide an explanation for why you've updated it to include status.goingAway when closeCode is null? Comments clarifying the purpose of this change would be appreciated.

Thanks again for your contribution!

@jrlwazo
Copy link
Contributor Author

jrlwazo commented Aug 26, 2023

It seems you've added additional conditions for closeCode . Previously, I was only checking for closeCode != null . Could you please provide some context on why these specific codes (1000 and 1005) are excluded? Adding comments explaining the rationale behind these changes would be helpful.

When a socket is closed, it is typically closed with a status code. In the above case, I am simply suggesting to an error is not thrown when the code is 1000 (normal closure) or 1005 (no status code provided), as these are not failures.

The previous code simply closed the channel using channel.sink.close();. Could you provide an explanation for why you've updated it to include status.goingAway when closeCode is null? Comments clarifying the purpose of this change would be appreciated.

When closing the connection, It is good practice to send the status code with the closure. In this case, the status code 1000 is sent when closing the connection, to indicate normal closure.

Hope this help to clarify the intention.

@aniketambore
Copy link
Owner

Thank you for clarifying the rationale behind your changes. Your explanations make sense, and I appreciate your attention to detail in improving the codebase.

@aniketambore aniketambore merged commit eb8cc30 into aniketambore:main Aug 27, 2023
2 checks passed
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.

2 participants