Created
September 13, 2018 20:07
-
-
Save Sean-Der/f9a2a28ae10d0ce033b8b5e8b9feecfd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/internal/network/port-receive.go b/internal/network/port-receive.go | |
| index 4216a7e..12fdd49 100644 | |
| --- a/internal/network/port-receive.go | |
| +++ b/internal/network/port-receive.go | |
| @@ -100,6 +100,7 @@ func (p *port) handleDTLS(raw []byte, srcAddr string) { | |
| } | |
| if len(decrypted) > 0 { | |
| + fmt.Printf("decrypted %v ", decrypted) | |
| p.handleSCTP(decrypted, p.m.sctpAssociation) | |
| } | |
| @@ -147,6 +148,8 @@ func (p *port) networkLoop() { | |
| continue | |
| } | |
| + fmt.Printf("recv %v ", in.buffer) | |
| + | |
| // https://tools.ietf.org/html/rfc5764#page-14 | |
| if 127 < in.buffer[0] && in.buffer[0] < 192 { | |
| p.handleSRTP(in.buffer) | |
| diff --git a/internal/sctp/association.go b/internal/sctp/association.go | |
| index 21be995..4acae71 100644 | |
| --- a/internal/sctp/association.go | |
| +++ b/internal/sctp/association.go | |
| @@ -311,6 +311,7 @@ func (a *Association) handleInit(p *packet, i *chunkInit) *packet { | |
| func (a *Association) handleData(d *chunkPayloadData) *packet { | |
| + fmt.Printf("payloadQueue.push %v %v \n", d, a.peerLastTSN) | |
| a.payloadQueue.push(d, a.peerLastTSN) | |
| pd, popOk := a.payloadQueue.pop(a.peerLastTSN + 1) | |
| @@ -349,6 +350,7 @@ func (a *Association) handleData(d *chunkPayloadData) *packet { | |
| sack.gapAckBlocks = a.payloadQueue.getGapAckBlocks(a.peerLastTSN) | |
| outbound.chunks = []chunk{sack} | |
| + fmt.Printf("handleData outbound %v \n", outbound) | |
| return outbound | |
| } | |
| @@ -422,6 +424,8 @@ func (a *Association) handleChunk(p *packet, c chunk) error { | |
| // TODO: Create ABORT | |
| } | |
| + fmt.Printf("handleChunk %v %v \n", p, c) | |
| + | |
| switch c := c.(type) { | |
| case *chunkInit: | |
| switch a.state { | |
| diff --git a/internal/sctp/payload_queue.go b/internal/sctp/payload_queue.go | |
| index 205d7d6..539e803 100644 | |
| --- a/internal/sctp/payload_queue.go | |
| +++ b/internal/sctp/payload_queue.go | |
| @@ -1,6 +1,9 @@ | |
| package sctp | |
| -import "sort" | |
| +import ( | |
| + "fmt" | |
| + "sort" | |
| +) | |
| type payloadDataArray []*chunkPayloadData | |
| @@ -36,6 +39,7 @@ func (r *payloadQueue) push(p *chunkPayloadData, cumulativeTSN uint32) { | |
| // If the Data payload is already in our queue or older than our cumulativeTSN marker | |
| if ok || p.tsn <= cumulativeTSN { | |
| // Found the packet, log in dups | |
| + fmt.Printf("dup %d %d \n", r.dupTSN, p.tsn) | |
| r.dupTSN = append(r.dupTSN, p.tsn) | |
| return | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment