send CONNECTION_CLOSE from the normal run loop

fixes #199
This commit is contained in:
Lucas Clemente
2016-07-10 15:03:23 +02:00
parent 2d828fe6e2
commit e303a7f578
2 changed files with 24 additions and 16 deletions

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"fmt"
"sync/atomic"
"github.com/lucas-clemente/quic-go/frames"
"github.com/lucas-clemente/quic-go/handshake"
@@ -20,12 +19,11 @@ type packedPacket struct {
}
type packetPacker struct {
connectionID protocol.ConnectionID
version protocol.VersionNumber
cryptoSetup *handshake.CryptoSetup
lastPacketNumber protocol.PacketNumber
connectionID protocol.ConnectionID
version protocol.VersionNumber
cryptoSetup *handshake.CryptoSetup
connectionParametersManager *handshake.ConnectionParametersManager
streamFramer *streamFramer
@@ -60,10 +58,8 @@ func (p *packetPacker) packPacket(stopWaitingFrame *frames.StopWaitingFrame, con
p.controlFrames = append(p.controlFrames, controlFrames...)
}
currentPacketNumber := protocol.PacketNumber(atomic.AddUint64(
(*uint64)(&p.lastPacketNumber),
1,
))
p.lastPacketNumber++
currentPacketNumber := p.lastPacketNumber
// cryptoSetup needs to be locked here, so that the AEADs are not changed between
// calling DiversificationNonce() and Seal().