Add constants (enumlike) for stanza types and simplify packet creation (#62)

* Add constants (enumlike) for stanza types
* NewIQ, NewMessage and NewPresence are now initialized with the Attrs struct
* Update examples
* Do not export backoff code. For now, we do not need to expose backoff in the documentation
* Make presence priority an int8
This commit is contained in:
genofire
2019-06-22 11:13:33 +02:00
committed by Mickaël Rémond
parent 145fce6b3f
commit d9fdff0839
28 changed files with 299 additions and 225 deletions

View File

@@ -104,7 +104,7 @@ func (sm *StreamManager) Stop() {
// connect manages the reconnection loop and apply the define backoff to avoid overloading the server.
func (sm *StreamManager) connect() error {
var backoff Backoff // TODO: Group backoff calculation features with connection manager?
var backoff backoff // TODO: Group backoff calculation features with connection manager?
for {
var err error
@@ -118,7 +118,7 @@ func (sm *StreamManager) connect() error {
return xerrors.Errorf("unrecoverable connect error %w", actualErr)
}
}
backoff.Wait()
backoff.wait()
} else { // We are connected, we can leave the retry loop
break
}