Skip to content

Instantly share code, notes, and snippets.

@Sean-Der Sean-Der/dtls.diff
Created Oct 29, 2019

Embed
What would you like to do?
diff --git a/conn.go b/conn.go
index bf5a88e..33c805a 100644
--- a/conn.go
+++ b/conn.go
@@ -500,6 +500,7 @@ func (c *Conn) handleIncomingPacket(buf []byte) (*alert, error) {
}
if h.epoch < c.getRemoteEpoch() {
+ c.log.Debugf("retransmitting, got message from old epoch: %v %v", h.epoch, c.getRemoteEpoch())
if _, alertPtr, err := c.flightHandler(c); err != nil {
return alertPtr, err
}
@@ -557,12 +558,13 @@ func (c *Conn) handleIncomingPacket(buf []byte) (*alert, error) {
return nil, fmt.Errorf("alert: %v", content)
case *changeCipherSpec:
c.log.Trace("<- ChangeCipherSpec")
- c.setRemoteEpoch(c.getRemoteEpoch() + 1)
+ c.setRemoteEpoch(h.epoch + 1)
case *applicationData:
if h.epoch == 0 {
return &alert{alertLevelFatal, alertUnexpectedMessage}, fmt.Errorf("ApplicationData with epoch of 0")
}
+ c.log.Debugf("decrypted with len(%v)", len(content.data))
c.decrypted <- content.data
default:
return &alert{alertLevelFatal, alertUnexpectedMessage}, fmt.Errorf("unhandled contentType %d", content.contentType())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.