Skip to content

Instantly share code, notes, and snippets.

@Sean-Der
Created September 4, 2019 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sean-Der/5a166e16b5383daf3788a776d7845d60 to your computer and use it in GitHub Desktop.
Save Sean-Der/5a166e16b5383daf3788a776d7845d60 to your computer and use it in GitHub Desktop.
diff --git a/association.go b/association.go
index 2e3aab1..e0ec341 100644
--- a/association.go
+++ b/association.go
@@ -377,6 +377,8 @@ func (a *Association) closeAllTimers() {
a.ackTimer.close()
}
+var conn net.Conn
+
func (a *Association) readLoop() {
var closeErr error
defer func() {
@@ -406,6 +408,14 @@ func (a *Association) readLoop() {
break
}
+ if conn == nil {
+ conn, err = net.Dial("udp", "127.0.0.1:1234")
+ if err != nil {
+ panic(err)
+ }
+ }
+ conn.Write(buffer[:n])
+
atomic.AddUint64(&a.bytesReceived, uint64(n))
if err = a.handleInbound(buffer[:n]); err != nil {
a.log.Warnf("[%s] %s]", a.name, errors.Wrap(err, "failed to push SCTP packet").Error())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment