更新通道逻辑优化

This commit is contained in:
langhuihui
2021-06-26 13:50:56 +08:00
parent 1105d732ae
commit 51d8a8fa91

View File

@@ -59,6 +59,7 @@ func (d *Device) addChannel(channel *Channel) {
func (d *Device) UpdateChannels(list []*Channel) {
d.channelMutex.Lock()
defer d.channelMutex.Unlock()
d.Channels = nil
for _, c := range list {
c.device = d
if c.ParentID != "" {
@@ -123,7 +124,6 @@ func (d *Device) CreateMessage(Method sip.Method) (requestMsg *sip.Message) {
return
}
func (d *Device) Query() int {
d.Channels = nil
requestMsg := d.CreateMessage(sip.MESSAGE)
requestMsg.ContentType = "Application/MANSCDP+xml"
requestMsg.Body = fmt.Sprintf(`<?xml version="1.0"?>