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

feature: Cancellable connection establish event #1085

Open
wants to merge 1 commit into
base: dev/3.0.0
Choose a base branch
from

Conversation

kezz
Copy link
Contributor

@kezz kezz commented Sep 19, 2023

Don't know if it makes more sense to do something else that isn't blocking on this event firing - couldn't really think of a better way to handle it. Potential for this to be expanded in the future to distinguish between ping vs. connection.

Copy link

@Dominik48N Dominik48N left a comment

Choose a reason for hiding this comment

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

Good pull request. A feature that you need, in my opinion.

@Gerrygames
Copy link
Contributor

The event should include the intention of the connection.
Also instead of blocking you should disabled auto-reading while the event is being fired (like here for example).

@kezz
Copy link
Contributor Author

kezz commented Oct 13, 2023

In other event classes, the method arguments are not declared final. In order to ensure a uniform code style, I would remove the final here.

I'm just going to leave this one, it's a better code style that is less error prone. Other event classes, for example, do not have nullness annotations, we shouldn't follow that just because they use that style.

The event should include the intention of the connection. Also instead of blocking you should disabled auto-reading while the event is being fired (like here for example).

Thanks, edited this and it should be good now.

Comment on lines +92 to +94
server.getEventManager()
.fire(new ConnectionEstablishEvent(
ic, getIntentionForStatus(handshake.getNextStatus())))
Copy link
Contributor

Choose a reason for hiding this comment

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

If getIntentionForStatus returns null, I would prefer if we just closed the connection right then and there. But I can understand why we might want to check for an invalid status.

@4drian3d 4drian3d added the type: feature New feature or request label Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants