Skip to content

Allow to disable automatically sending PING acks.#9338

Merged
normanmaurer merged 1 commit into4.1from
auto_ack_ping
Jul 12, 2019
Merged

Allow to disable automatically sending PING acks.#9338
normanmaurer merged 1 commit into4.1from
auto_ack_ping

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

There are situations where the user may want to be more flexible when to send the PING acks for various reasons or be able to attach a listener to the future that is used for the ping ack. To be able to do so we should allow to manage the acks manually.

Modifications:

  • Add constructor to DefaultHttp2ConnectionDecoder that allows to disable the automatically sending of ping acks (default is to send automatically to not break users)
  • Add methods to AbstractHttp2ConnectionHandlerBuilder (and sub-classes) to either enable ot disable auto acks for pings
  • Add unit test

Result:

More flexible way of handling acks.

Motivation:

There are situations where the user may want to be more flexible when to send the PING acks for various reasons or be able to attach a listener to the future that is used for the ping ack. To be able to do so we should allow to manage the acks manually.

Modifications:

- Add constructor to DefaultHttp2ConnectionDecoder that allows to disable the automatically sending of ping acks (default is to send automatically to not break users)
- Add methods to AbstractHttp2ConnectionHandlerBuilder (and sub-classes) to either enable ot disable auto acks for pings
- Make DefaultHttp2PingFrame constructor public that allows to write acks.
- Add unit test

Result:

More flexible way of handling acks.
Copy link
Copy Markdown
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

LGTM

}

/**
* Determine if PING frame should automatically be acknowledged or not.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was going to suggest to mention here that the default is true but I guess the doc is consistent with autoAckSettingsFrame.

Copy link
Copy Markdown
Contributor

@franz1981 franz1981 left a comment

Choose a reason for hiding this comment

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

LGTM

@normanmaurer
Copy link
Copy Markdown
Member Author

This only question about this is if we also need to somehow ensure we ack back in the same order or if its the responsibility to do... I mean I can even not find it really called in the RFC that it needs to be in the same order but I would expect that a lot of implementations may break if it is not the same order..

/cc @ejona86 @Scottmitch @carl-mastrangelo

So for example what we could do is have a queue with longs and on each ping ack verify that the payload is the same as for the ping and if not fail the write or tear down the connection with a connection error.

Copy link
Copy Markdown
Member

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

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

LGTM

@normanmaurer
Copy link
Copy Markdown
Member Author

After thinking more about this (and talking with @ejona86) I think it should just be the users responsibility to ensure correct ordering :)

@normanmaurer
Copy link
Copy Markdown
Member Author

@ejona86 want to take a look as well ?

@ejona86
Copy link
Copy Markdown
Member

ejona86 commented Jul 10, 2019

Yeah, I'll take a look.

@normanmaurer normanmaurer merged commit 906fc02 into 4.1 Jul 12, 2019
@normanmaurer normanmaurer deleted the auto_ack_ping branch July 12, 2019 16:15
normanmaurer added a commit that referenced this pull request Jul 12, 2019
Motivation:

There are situations where the user may want to be more flexible when to send the PING acks for various reasons or be able to attach a listener to the future that is used for the ping ack. To be able to do so we should allow to manage the acks manually.

Modifications:

- Add constructor to DefaultHttp2ConnectionDecoder that allows to disable the automatically sending of ping acks (default is to send automatically to not break users)
- Add methods to AbstractHttp2ConnectionHandlerBuilder (and sub-classes) to either enable ot disable auto acks for pings
- Make DefaultHttp2PingFrame constructor public that allows to write acks.
- Add unit test

Result:

More flexible way of handling acks.
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.

5 participants