mirror of
https://github.com/mautrix/telegram.git
synced 2026-05-17 07:25:46 +03:00
gotd: assume any response is an ack
This commit is contained in:
@@ -10,11 +10,13 @@ func (e *Engine) NotifyAcks(ids []int64) {
|
||||
defer e.mux.Unlock()
|
||||
|
||||
for _, id := range ids {
|
||||
ch, ok := e.ack[id]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
e.notifyAckUnlocked(id)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Engine) notifyAckUnlocked(id int64) {
|
||||
ch, ok := e.ack[id]
|
||||
if ok {
|
||||
close(ch)
|
||||
delete(e.ack, id)
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ func (e *Engine) retryUntilAck(ctx context.Context, req Request) (sent bool, err
|
||||
// NotifyResult notifies engine about received RPC response.
|
||||
func (e *Engine) NotifyResult(msgID int64, b *bin.Buffer) error {
|
||||
e.mux.Lock()
|
||||
e.notifyAckUnlocked(msgID)
|
||||
fn, ok := e.rpc[msgID]
|
||||
e.mux.Unlock()
|
||||
if !ok {
|
||||
@@ -245,6 +246,7 @@ func (e *Engine) NotifyResult(msgID int64, b *bin.Buffer) error {
|
||||
func (e *Engine) NotifyError(msgID int64, rpcErr error) {
|
||||
e.onError(rpcErr)
|
||||
e.mux.Lock()
|
||||
e.notifyAckUnlocked(msgID)
|
||||
fn, ok := e.rpc[msgID]
|
||||
e.mux.Unlock()
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user