diff --git a/connection.go b/connection.go index 9c8821d91ff..cb31e143f97 100644 --- a/connection.go +++ b/connection.go @@ -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: @@ -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 diff --git a/connection_test.go b/connection_test.go index fe318d22171..26679987185 100644 --- a/connection_test.go +++ b/connection_test.go @@ -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())