X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/53c6c8a5a17e2dfc8bd3ff02ab99d29d709dda2f..d9fddc0f506eb4ead7049f5638674b2b8773fcaa:/whatsapp.go diff --git a/whatsapp.go b/whatsapp.go index e02e8c6..c3db573 100644 --- a/whatsapp.go +++ b/whatsapp.go @@ -209,10 +209,10 @@ type WhatsApp struct { // failed first connection starts the same outage notice as a lost connection. A // timer in the select retries it with a doubled wait from 2 seconds to 5 // minutes, without a retry goroutine or a wait that blocks commands or the -// inbox. A connection, unlink, logout, pair command, or ctx end stops retries. -// The library owns retries after a connection opens. Run returns the error of a -// write of the log or of the state file, which stops the daemon, because then -// messages would be lost. +// inbox. A connection, unlink, logout, or ctx end stops retries. The library +// owns retries after a connection opens. Run returns the error of a write of +// the log or of the state file, which stops the daemon, because then messages +// would be lost. func (w *WhatsApp) Run(ctx context.Context, l *TurnLoop, notify func(Event)) error { w.mutex.Lock() w.notify = notify @@ -277,13 +277,13 @@ func (w *WhatsApp) Run(ctx context.Context, l *TurnLoop, notify func(Event)) err return err } case request := <-w.requests: - stopRetry() cancel() pairing.Wait() cancel = func() {} switch { case request.unlink: + stopRetry() err = w.unlink(ctx, l, request.answer) if err != nil { return err