// Serve listens for the first packet from a new PFCP peer and creates PFCPConn.
Serve listens for the first packet from a new PFCP peer and creates PFCPConn.
// Serve listens for the first packet from a new PFCP peer and creates PFCPConn .
func (node *PFCPNode) Serve() {
	go node.handleNewPeers()
	shutdown := false
	for !shutdown {
		select {
		case fseid := <-node.upf.reportNotifyChan:
			for _, pConn := range node.pConns {
				pConn.handleDigestReport(fseid)
				break
			}
		case rAddr := <-node.pConnDone:
			delete(node.pConns, rAddr)
			log.Infoln("Removed connection to", rAddr)
		case <-node.ctx.Done():
			shutdown = true
			log.Infoln("Entering node shutdown")
			err := node.Close()
			if err != nil {
				log.Errorln("Error closing PFCPNode conn", err)
			}
			for len(node.pConns) > 0 {
				rAddr := <-node.pConnDone
				delete(node.pConns, rAddr)
				log.Infoln("Removed connection to", rAddr)
			}
			close(node.pConnDone)
			log.Infoln("Done waiting for PFCPConn completions")
		}
	}
	close(node.done)
}
func ( node * PFCPNode ) Serve ( ) { go node . handleNewPeers ( ) shutdown := false for ! shutdown { select { case fseid := <- node . upf . reportNotifyChan : for _ , pConn := range node . pConns { pConn . handleDigestReport ( fseid ) break } case rAddr := <- node . pConnDone : delete ( node . pConns , rAddr ) log . Infoln ( " " , rAddr ) case <- node . ctx . Done ( ) : shutdown = true log . Infoln ( " " ) err := node . Close ( ) if err != nil { log . Errorln ( " " , err ) } for len ( node . pConns ) > 0 { rAddr := <- node . pConnDone delete ( node . pConns , rAddr ) log . Infoln ( " " , rAddr ) } close ( node . pConnDone ) log . Infoln ( " " ) } } close ( node . done ) }
Serve listens for the first packet from a new PFCP peer and creates PFCPConn.
Serve listens for the first packet from a new PFCP peer and creates PFCPConn .
// TODO: Logic to distinguish PFCPConn based on SEID // Clear out the remaining pconn completions