func (p *Peer) Leave(msg *proto.FromClientLeaveMsg) error {
	log.Infof("peer leave: uid=%s, msg=%v", p.uid, msg)

	// leave room
	p.s.delPeer(msg.SID, p.uid)

	if _, err := p.s.nrpc.Request(p.s.islb, proto.IslbPeerLeaveMsg{
		RoomInfo: proto.RoomInfo{UID: p.uid, SID: msg.SID},
	}); err != nil {
		log.Errorf("leave %s error: %v", p.s.islb, err.Error())
	}

	sfu, err := p.sfu()
	if err != nil {
		log.Errorf("sfu-node not found: %s", err)
	}
	if _, err := p.s.nrpc.Request(sfu, proto.ToSfuLeaveMsg{
		MID: p.mid,
	}); err != nil {
		log.Errorf("leave %s error: %v", sfu, err.Error())
	}

	return nil
}
// Leave client leave the room
Leave client leave the room
// Leave client leave the room
func (p *Peer) Leave(msg *proto.FromClientLeaveMsg) error {
	log.Infof("peer leave: uid=%s, msg=%v", p.uid, msg)
	p.s.delPeer(msg.SID, p.uid)
	if _, err := p.s.nrpc.Request(p.s.islb, proto.IslbPeerLeaveMsg{
		RoomInfo: proto.RoomInfo{UID: p.uid, SID: msg.SID},
	}); err != nil {
		log.Errorf("leave %s error: %v", p.s.islb, err.Error())
	}
	sfu, err := p.sfu()
	if err != nil {
		log.Errorf("sfu-node not found: %s", err)
	}
	if _, err := p.s.nrpc.Request(sfu, proto.ToSfuLeaveMsg{
		MID: p.mid,
	}); err != nil {
		log.Errorf("leave %s error: %v", sfu, err.Error())
	}
	return nil
}
func ( p * Peer ) Leave ( msg * proto . FromClientLeaveMsg ) error { log . Infof ( " " , p . uid , msg ) p . s . delPeer ( msg . SID , p . uid ) if _ , err := p . s . nrpc . Request ( p . s . islb , proto . IslbPeerLeaveMsg { RoomInfo : proto . RoomInfo { UID : p . uid , SID : msg . SID } , } ) ; err != nil { log . Errorf ( " " , p . s . islb , err . Error ( ) ) } sfu , err := p . sfu ( ) if err != nil { log . Errorf ( " " , err ) } if _ , err := p . s . nrpc . Request ( sfu , proto . ToSfuLeaveMsg { MID : p . mid , } ) ; err != nil { log . Errorf ( " " , sfu , err . Error ( ) ) } return nil }
Leave client leave the room
Leave client leave the room
// leave room