-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
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
This reverts commit f5d96d2.
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
This reverts commit f5d96d2.
@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:
We should be able to do that today or tomorrow depending on your availability. Separately, we can:
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? |
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:
|
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: frameLength
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
Hand-merge + squash of Piet De Vaere's giant PR. Fixes #37.
this is #30 and #33 on top of #36