Skip to content

Commit

Permalink
Allow Associations to be named
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels committed Feb 28, 2024
1 parent a5583a6 commit cfe9774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion association.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ type Association struct {
// Config collects the arguments to createAssociation construction into
// a single structure
type Config struct {
Name string
NetConn net.Conn
MaxReceiveBufferSize uint32
MaxMessageSize uint32
Expand Down Expand Up @@ -329,9 +330,12 @@ func createAssociation(config Config) *Association {
silentError: ErrSilentlyDiscard,
stats: &associationStats{},
log: config.LoggerFactory.NewLogger("sctp"),
name: config.Name,
}

a.name = fmt.Sprintf("%p", a)
if a.name == "" {
a.name = fmt.Sprintf("%p", a)
}

// RFC 4690 Sec 7.2.1
// o The initial cwnd before DATA transmission or after a sufficiently
Expand Down
2 changes: 2 additions & 0 deletions association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func createNewAssociationPair(br *test.Bridge, ackMode int, recvBufSize uint32)

go func() {
a0, err0 = Client(Config{
Name: "a0",
NetConn: br.GetConn0(),
MaxReceiveBufferSize: recvBufSize,
LoggerFactory: loggerFactory,
Expand All @@ -265,6 +266,7 @@ func createNewAssociationPair(br *test.Bridge, ackMode int, recvBufSize uint32)
}()
go func() {
a1, err1 = Client(Config{
Name: "a1",
NetConn: br.GetConn1(),
MaxReceiveBufferSize: recvBufSize,
LoggerFactory: loggerFactory,
Expand Down

0 comments on commit cfe9774

Please sign in to comment.