Skip to content

calibre: use correct callback when Wi-Fi is off at connect time#14998

Merged
Frenzie merged 1 commit into
koreader:masterfrom
msk:fix/calibre-wifi-callback
Feb 17, 2026
Merged

calibre: use correct callback when Wi-Fi is off at connect time#14998
Frenzie merged 1 commit into
koreader:masterfrom
msk:fix/calibre-wifi-callback

Conversation

@msk

@msk msk commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

When Wi-Fi is off and the user taps "Connect to calibre", the plugin asks NetworkMgr to bring up Wi-Fi and re-run a callback to resume the connection flow. However, the callback passed is self.re, which isn't assigned until later in the function (line 292). At line 244 it is always nil, either never set, or explicitly cleared by a previous disconnect().

The nil propagates silently through the NetworkMgr chain (beforeWifiActionenableWificonnectivityCheck) because connectivityCheck guards the callback call with if callback then. The result: Wi-Fi comes up successfully, but the Calibre connection coroutine is never resumed. No error is shown to the user.


This change is Reviewable

`self.re` isn't assigned until later in connect() (line 292), so at line
244 it is always nil — either never set, or cleared by a previous
disconnect(). This caused willRerunWhenConnected to receive nil as its
callback, so after Wi-Fi was brought up the coroutine was never resumed
and the Calibre connection silently died.

Use the local `re` (defined on line 234) which is the correct resume
callback for this coroutine.

@benoit-pierre benoit-pierre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@Frenzie Frenzie merged commit cffae09 into koreader:master Feb 17, 2026
4 checks passed
@Frenzie Frenzie added this to the 2026.02 milestone Feb 17, 2026
@Frenzie Frenzie added the Plugin label Feb 17, 2026
@msk msk deleted the fix/calibre-wifi-callback branch March 3, 2026 18:38
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
`self.re` isn't assigned until later in connect() (line 292), so at line
244 it is always nil — either never set, or cleared by a previous
disconnect(). This caused willRerunWhenConnected to receive nil as its
callback, so after Wi-Fi was brought up the coroutine was never resumed
and the Calibre connection silently died.

Use the local `re` (defined on line 234) which is the correct resume
callback for this coroutine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants