uMQTT_Simple suggestions: #1: Return ping result instead of None & #2: Make socket write under 'disconnect' & 'ping' non-blocking
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- networking
調査の方向性
uMQTT_Simple の実装で、205 行目付近の wait_msg セクション #PINGRESP から始め、続いて 122 行目付近と 118 行目付近の ping と disconnect を調べます。check_msg()、wait_msg()、および SSL ソケットが現在どのように書き込みを処理しているかを確認します。完了条件は、ping 応答の値を返し、指定されたソケット書き込みがブロックしないようにし、接続済みの場合と接続が失われた場合の動作を検証することです。
索引モデルが issue の本文から書いたものです。
説明
Suggestion (#1) for a small change in line 205 ('section' #PINGRESP in function wait_msg):
return res[0] instead of return None
This allows you to check in your own consumer code that called check_msg() or wait_msg(), that the ping response came by and was valid, e.g.: if(oReply == 0xD0): # valid ping response
And suggestion (#2) for another small change in line 122 (section 'ping') and line 118 (section 'disconnect'):
add line self.sock.setblocking(False) in front of self.sock.write(b"...")
This prevents lóóóng (default 30 secs?) lock-ups when the connection is lost (or not ready yet).
I haven't experienced a down-side yet of this non-blocking write (with and without a working connection).
P.s. I guess the problem is only valid when using SSL, as the (plain) socket is otherwise already initiated with specified timeout at 'connect' and may not stall that long. Once wrapped in an SSL socket though, the original timeout seems either lost or ineffective. Attempting to use settimeout(t) instead of setblocking(False) here before writing to the socket, is currently not possible with SSL sockets in micropython (see this request)
Thanks!
- 主要言語
- Python
- スター
- 2.9k
- フォーク
- 1.1k
- 平均マージ
- 7日 6時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
micropython/micropython-lib のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
micropython/micropython-lib#1074 ·
-
needs-info
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
micropython/micropython-lib#943 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
micropython/micropython-lib#931 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
micropython/micropython-lib#795 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
micropython/micropython-lib#762 ·
micropython/micropython-lib の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
zostera/django-bootstrap4#894 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
use-agent-os/agent-os#3276 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NousResearch/hermes-agent#117848 ·