From 0e5f627ff2ad0049274928aa6a59ea4f902ac102 Mon Sep 17 00:00:00 2001 From: Louis Royer Date: Wed, 4 Sep 2024 13:00:58 +0200 Subject: [PATCH] Add PFCPEntity.Stop() close #28 --- README.md | 2 ++ pfcp/entity.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 02913ed..06c0237 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ ```golang upNode := NewPFCPEntityUP(UPF_NODE_ID, UPF_IP_ADDR) // node id can be an IP Address or a FQDN upNode.Start() +defer upNode.Close() // Access list of associations associations := upNode.GetPFCPAssociations() // Access list of sessions @@ -23,6 +24,7 @@ sessions := upNode.GetPFCPSessions() ```golang cpNode := NewPFCPEntityCP(SMF_NODE_ID, SMF_IP_ADDR) // node id can be an IP Address or a FQDN cpNode.Start() +defer cpNode.Close() association, _ := cpNode.NewEstablishedPFCPAssociation(ie.NewNodeIDHeuristic(UPFADDR)) session, _ := a.CreateSession(pdrs, fars) diff --git a/pfcp/entity.go b/pfcp/entity.go index 4d3800c..fa6e158 100644 --- a/pfcp/entity.go +++ b/pfcp/entity.go @@ -206,6 +206,10 @@ func (e *PFCPEntity) Start() error { return nil } +func (e *PFCPEntity) Stop() error { + return e.conn.Close() +} + func (e *PFCPEntity) IsUserPlane() bool { return e.kind == "UP" }