Don't block on unanswered IQs.

no-tls
Martin Dosch 4 months ago
parent 8c5c0ce508
commit a3cd1fe0a9
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -7,6 +7,7 @@
- Improve file name for private Ox keys.
- Improve fallback behavior if no SRV records are provided.
- Remove 100ms sleep before closing the connection. This should be no more needed since go-xmpp commit 9684a8ff690f0d75e284f8845696c5057926d276.
- Return an error if there is no answer to an IQ within 60s.
## [v0.8.3] 2024-02-17
### Changed

@ -6,9 +6,11 @@ package main
import (
"context"
"errors"
"fmt"
"log"
"runtime"
"time"
"github.com/beevik/etree" // BSD-2-clause
"github.com/xmppo/go-xmpp" // BSD-3-Clause
@ -24,7 +26,11 @@ func sendIQ(client *xmpp.Client, iqc chan xmpp.IQ, target string, iQtype string,
if err != nil {
return iq, fmt.Errorf("sendIQ: failed to send iq: %w", err)
}
iq = <-c
select {
case iq = <-c:
case <-time.After(60 * time.Second):
return iq, errors.New("sendIQ: server didn't reply to IQ: " + content)
}
return iq, nil
}

Loading…
Cancel
Save