Skip to content

Commit

Permalink
schedule sending when writing initial or handshake crypto data
Browse files Browse the repository at this point in the history
No functional change expected. We already did schedule sending for all
cases but the ClientHello. Scheduling explicitly allows us to remove
this corner case.
  • Loading branch information
marten-seemann committed Apr 11, 2024
1 parent da410a7 commit b0e588d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions connection.go
Expand Up @@ -514,10 +514,6 @@ func (s *connection) run() error {
}
}()

if s.perspective == protocol.PerspectiveClient {
s.scheduleSending() // so the ClientHello actually gets sent
}

var sendQueueAvailable <-chan struct{}

runLoop:
Expand Down Expand Up @@ -1406,8 +1402,10 @@ func (s *connection) handleHandshakeEvents() error {
err = s.dropEncryptionLevel(protocol.Encryption0RTT)
case handshake.EventWriteInitialData:
_, err = s.initialStream.Write(ev.Data)
s.scheduleSending()
case handshake.EventWriteHandshakeData:
_, err = s.handshakeStream.Write(ev.Data)
s.scheduleSending()
}
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions connection_test.go
Expand Up @@ -2588,6 +2588,7 @@ var _ = Describe("Client Connection", func() {
defer GinkgoRecover()
cryptoSetup.EXPECT().StartHandshake().MaxTimes(1)
cryptoSetup.EXPECT().NextEvent().Return(handshake.Event{Kind: handshake.EventNoEvent})
conn.scheduleSending()
conn.run()
}()
Eventually(done).Should(BeClosed())
Expand Down

0 comments on commit b0e588d

Please sign in to comment.