Skip to content

Commit

Permalink
another approach #85
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarnathCJD committed Mar 22, 2024
1 parent 171e900 commit 3f9bfc8
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions mtproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,24 +528,35 @@ messageTypeSwitching:
}
}

var badMsgResponseChannel chan tl.Object
for _, v := range m.responseChannels.Keys() {
if v == int(message.BadMsgID) {
badMsgResponseChannel, _ = m.responseChannels.Get(v)
m.responseChannels.Delete(v)
break
}
}
var respChannelsBackup *utils.SyncIntObjectChan
m.mutex.Lock()
respChannelsBackup = m.responseChannels

m.responseChannels = utils.NewSyncIntObjectChan()

//var badMsgResponseChannel chan tl.Object
//for _, v := range m.responseChannels.Keys() {
// if v == int(message.BadMsgID) {
// badMsgResponseChannel, _ = m.responseChannels.Get(v)
// m.responseChannels.Delete(v)
// break
// }
//}

m.Reconnect(false)

m.mutex.Lock()
if badMsgResponseChannel != nil {
badMsgResponseChannel <- &errorSessionConfigsChanged{}
}
//m.mutex.Lock()
//if badMsgResponseChannel != nil {
// badMsgResponseChannel <- &errorSessionConfigsChanged{}
//}

//for _, k := range m.responseChannels.Keys() {
// v, _ := m.responseChannels.Get(k)
// v <- &errorSessionConfigsChanged{}
//}

for _, k := range m.responseChannels.Keys() {
v, _ := m.responseChannels.Get(k)
for _, k := range respChannelsBackup.Keys() {
v, _ := respChannelsBackup.Get(k)
v <- &errorSessionConfigsChanged{}
}

Expand Down

0 comments on commit 3f9bfc8

Please sign in to comment.