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

Cc and optimization pr #37

Closed
wants to merge 48 commits into from

Conversation

pietdevaere
Copy link
Contributor

this is #30 and #33 on top of #36

When selecting the number of frames and acks to be transmitted,
the header size and AEAD overhead were not considered when determining
the space left in the packet.
Problem was that it was decied to generate an ack frame
BEFORE it was known that there was space to put acks in the
packet. This resulted in an empty rs slice, causing errors
should now be able to handle ack rangesx
When selecting the number of frames and acks to be transmitted,
the header size and AEAD overhead were not considered when determining
the space left in the packet.
Problem was that it was decied to generate an ack frame
BEFORE it was known that there was space to put acks in the
packet. This resulted in an empty rs slice, causing errors
should now be able to handle ack rangesx
@ekr
Copy link
Owner

ekr commented Nov 30, 2017

@pietdevaere: the integration pieces look basically sound. I have some minor comments as you can see. It's going to take me some time to review the congestion piece, and I see it doesn't have any tests so I suggest we land that separately. Specifically, I suggest:

  1. Clean up the issues I noted.
  2. Add a dummy congestion controller that just allows sending at all times. Thanks for doing an interface there, that makes things much easier.
  3. Fix the merge issues (I may be able to help with that, as it looks like in part you just have duplicate commits)
  4. Land all the code except for congestion.go

We should be able to do that today or tomorrow depending on your availability.

Separately, we can:

  1. Write tests for congestion.go
  2. Review congestion.go
  3. Land it

I don't plan to work on that file myself (modulo review), so it shouldn't cause any merge/rebase issues.

Does that work for you?

@pietdevaere
Copy link
Contributor Author

That should work for me. I can make time for this tomorrow (and maybe tonight). I was planning to work on the congestion controller soon anyway (adding RTT estimation, not to big of a change).

Three remarks:

  1. I can not see your comments. Can you check what's up with that?
  2. That the congestion controller is easy to swap out is by design. I thought it would be useful to make it easy to experiment with different congestion controllers.
  3. congestion.go is a pretty direct implementation of draft-ietf-quic-recovery-06. That probably makes it easier to review.

frame.go Outdated
@@ -118,7 +119,7 @@ func decodeFrame(data []byte) (uintptr, *frame, error) {
return 0, nil, err
}

return n, &frame{0, inner, data[:n], nil, time.Now()}, nil
return n, &frame{0, inner, data[:n], nil, time.Now(), true}, nil
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this not false? I am assuming we're not going to transmit this frame.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, done.

stream.go Outdated
/* First check if we can append the new slice at the end */
if l := len(h.chunks); l == 0 || offset > h.chunks[l - 1].offset {
h.chunks = append(h.chunks, c)
/* Otherwise find out where it should go */
Copy link
Owner

Choose a reason for hiding this comment

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

Please put this comment after the opening brace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

stream.go Outdated
if offset < h.chunks[i].offset {
break
/* First check if we can append the new slice at the end */
if l := len(h.chunks); l == 0 || offset > h.chunks[l - 1].offset {
Copy link
Owner

Choose a reason for hiding this comment

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

Given that we're going to likely need len(chunks) repeatedly, let's instead do

var nchunks = len(h.chunks)

and then use nchunks repeatedly below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

tracking.go Outdated
pk.acked2 = true
if pn >= p.minNotAcked2 {
pk, ok := p.packets[pn]
//assert(ok)
Copy link
Owner

Choose a reason for hiding this comment

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

Should this packet always be in the array? If so, you want the assert and not the if.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it doesn't have to. If a packet has been acked2ed before it might have been removed from the map before. The assert was probably still there because removing the packets is something I added. I removed the assert.

connection.go Outdated
@@ -393,7 +401,7 @@ func (c *Connection) determineAead(pt uint8) cipher.AEAD {
return aead
}

func (c *Connection) sendPacketRaw(pt uint8, connId ConnectionId, pn uint64, version VersionNumber, payload []byte) error {
func (c *Connection) sendPacketRaw(pt uint8, connId ConnectionId, pn uint64, version VersionNumber, payload []byte, onlyAcks bool) error {
Copy link
Owner

Choose a reason for hiding this comment

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

does onlyAcks here mean "i am only acks" or "send only acks"? Please rename accordinly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

connection.go Outdated
// c.log(logTypeStream, "Examining frame=%v", f)
l, err := f.length()

frameLenght, err := f.length()
Copy link
Owner

Choose a reason for hiding this comment

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

typo: frameLength

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

connection.go Outdated
if err != nil {
return 0, err
}

// if there is no more space in the congestion window, stop
// trying to send stuff
if (spaceInCongestionWindow < frameLenght){
Copy link
Owner

Choose a reason for hiding this comment

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

This test seems like it should go after needsTransmit and the too recent test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed & done

connection.go Outdated
for _, frame := range queue {
for _, pn := range frame.pns {
if pn == lostPn {
frame.needsTransmit = true
Copy link
Owner

Choose a reason for hiding this comment

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

This looks wrong to me. Say we have a frame which appears in packet 1 and packet 2 and we get an ack for 2, but 1 is lost, why are we marking it for needsTransmit? Perhaps the frame has already been removed? At minimum you're gonna need a comment explaining why this is cool.

if this logic is right, you want a break at line 843 because you don't need to look at the rest of the pns

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, changed and commented.

connection.go Outdated
@@ -759,6 +834,19 @@ func (c *Connection) queueStreamFrames(pt uint8, protected bool, bareAcks bool)
return sent, nil
}

func (c *Connection) handleLostPackets(lostPn uint64){
Copy link
Owner

Choose a reason for hiding this comment

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

"handleLostPacket" because there is only one,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

connection.go Outdated
// TODO([email protected]): Process the ACK timestamps.

//TODO([email protected]) add timestamping stuff
Copy link
Owner

Choose a reason for hiding this comment

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

We can remove comments about timestamps because we're not supporting them

@ekr ekr closed this in 1b6d92b Dec 2, 2017
ekr added a commit that referenced this pull request Dec 2, 2017
Hand-merge + squash of Piet De Vaere's giant PR. Fixes #37.
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