Skip to content

Conversation

@masaori335
Copy link
Contributor

READ_READY event is always signaled itself when Http2ClientSession is started.
But this could waste some CPU cycle if there no data to read.

READ_READY event is always signaled itself when Http2ClientSession is started.
But this could waste some CPU cycle if there no data to read.
@masaori335 masaori335 added this to the 9.0.0 milestone Aug 14, 2019
@masaori335 masaori335 self-assigned this Aug 14, 2019
send_connection_event(&this->connection_state, HTTP2_SESSION_EVENT_INIT, this);
this->handleEvent(VC_EVENT_READ_READY, read_vio);

if (this->sm_reader->is_read_avail_more_than(0)) {
Copy link
Member

Choose a reason for hiding this comment

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

This implicitly says we have something to do if we can read 1 byte. What is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May be Connection Preface ?

Copy link
Member

Choose a reason for hiding this comment

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

Do we want the first byte of Connection Preface here? The length should be 10 bytes or so.

Copy link
Contributor Author

@masaori335 masaori335 Aug 15, 2019

Choose a reason for hiding this comment

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

I think we should not put these assumption here to make the logic simple.

Think about the error cases, if we start reading with 1 byte, the handler can reject the connection with malformed strings smaller than 10 bytes. ( actually, current state_read_connection_preface() doesn't do this )

Also, in the HTTP/2 over TLS case this is 0.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like we could remove this since nobody cares cleartext H2. That would be more simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's my first idea, but I'm not confident because there is a path of the buffer is given to the the Http2SessionAccept from the outside.

Copy link
Member

@shinrich shinrich 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. Should protect from spurious read ready events.

@shinrich
Copy link
Member

[approve ci autest]

@shinrich
Copy link
Member

Fixed the client_context_dump test in PR #5828. Don't know why the order would have changed, but the implementation is not assuming any order so seems reasonable to fix the test to look for content and rely on dump order.

@masaori335
Copy link
Contributor Author

[approve ci autest]

@masaori335
Copy link
Contributor Author

Merged #5828, I hope autest job success.

@masaori335
Copy link
Contributor Author

Looks #5828 fixed the autest job issue. ( or I'm just lucky )

@masaori335 masaori335 merged commit 03ff337 into apache:master Aug 15, 2019
@zwoop zwoop modified the milestones: 9.0.0, 8.1.0 Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants