diff --git a/README.md b/README.md index 14383e63f1f5..f07fe838c2c7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ MsQuic MsQuic is an implementation of the [IETF QUIC](https://tools.ietf.org/html/draft-ietf-quic-transport) protocol by Microsoft. It is a cross platform, general purpose QUIC library written in C. +[![Build Status](https://microsoft.visualstudio.com/OS/_apis/build/status/microsoft.msquic?branchName=master)](https://microsoft.visualstudio.com/OS/_build/latest?definitionId=45975&branchName=master) + ## Protocol Features QUIC has many benefits when compared to existing TLS over TCP scenarios: diff --git a/core/packet_builder.c b/core/packet_builder.c index 9cd1970daf5a..265ae9eaecb9 100644 --- a/core/packet_builder.c +++ b/core/packet_builder.c @@ -142,6 +142,7 @@ QuicPacketBuilderPrepare( DatagramSize = (uint16_t)Connection->Send.Allowance; } QUIC_DBG_ASSERT(!IsPathMtuDiscovery || !IsTailLossProbe); // Never both. + QUIC_DBG_ASSERT(NewPacketKey != NULL); // // Next, make sure the current QUIC packet matches the new packet type. If @@ -513,6 +514,8 @@ QuicPacketBuilderFinalizeHeaderProtection( _Inout_ QUIC_PACKET_BUILDER* Builder ) { + QUIC_DBG_ASSERT(Builder->Key != NULL); + QUIC_STATUS Status; if (QUIC_FAILED( Status = @@ -589,6 +592,7 @@ QuicPacketBuilderFinalize( QUIC_DBG_ASSERT(Builder->Datagram->Length >= Builder->MinimumDatagramLength); QUIC_DBG_ASSERT(Builder->Datagram->Length >= (uint32_t)(Builder->DatagramLength + Builder->EncryptionOverhead)); QUIC_DBG_ASSERT(Builder->Metadata->FrameCount != 0); + QUIC_DBG_ASSERT(Builder->Key != NULL); uint8_t* Header = (uint8_t*)Builder->Datagram->Buffer + Builder->PacketStart; @@ -774,6 +778,7 @@ QuicPacketBuilderFinalize( // // Update the packet key in use by the send builder. // + QUIC_DBG_ASSERT(Connection->Crypto.TlsState.WriteKeys[QUIC_PACKET_KEY_1_RTT] != NULL); Builder->Key = Connection->Crypto.TlsState.WriteKeys[QUIC_PACKET_KEY_1_RTT]; } } diff --git a/core/send.c b/core/send.c index 4e778d70b8ea..6949f390408c 100644 --- a/core/send.c +++ b/core/send.c @@ -449,7 +449,16 @@ QuicSendWriteFrames( } if (Send->SendFlags & (QUIC_CONN_SEND_FLAG_CONNECTION_CLOSE | QUIC_CONN_SEND_FLAG_APPLICATION_CLOSE)) { - BOOLEAN IsApplicationClose = !!(Send->SendFlags & QUIC_CONN_SEND_FLAG_APPLICATION_CLOSE); + BOOLEAN IsApplicationClose = + !!(Send->SendFlags & QUIC_CONN_SEND_FLAG_APPLICATION_CLOSE); + if (Connection->State.ClosedRemotely) { + // + // Application closed should only be the origination of the + // connection close. If we're closed remotely already, we should + // just acknowledge the close with a connection close frame. + // + IsApplicationClose = FALSE; + } QUIC_CONNECTION_CLOSE_EX Frame = { IsApplicationClose, @@ -459,23 +468,6 @@ QuicSendWriteFrames( Connection->CloseReasonPhrase }; - if (Connection->State.ClosedRemotely) { - // - // If we are already closed remotely, then that means we are just - // responding to (acknowledging in a sense) a received close frame. - // In that case, we just send an error code value of 0. Otherwise, - // we send whatever error code we have cached. - // - Frame.ErrorCode = 0; - // - // Application closed should always be the origination of the - // connection close. In other words, if the peer closed the - // connection first, then we should be responding with a connection - // close frame, instead of an app close frame. - // - QUIC_DBG_ASSERT(!IsApplicationClose); - } - if (QuicConnCloseFrameEncode( &Frame, &Builder->DatagramLength,