Commit 109571b
committed
fix: pre-probe MQTT port for clear error on blocked networks (#107)
When port 8883 is blocked by campus VPNs or firewalls (e.g. eduroam),
the MQTT client would hang for 60s then crash with a raw traceback.
Now pre-probes the port with a 5-second socket connection test:
- On failure: prints a clear error message suggesting the network
may be blocking the port, then exits gracefully.
- Also fixes a crash where setsockopt was called on a None socket
after a failed MQTT connect (the except block continued execution
instead of exiting).
Closes #1071 parent b3d61f6 commit 109571b
1 file changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
228 | 244 | | |
229 | 245 | | |
230 | 246 | | |
231 | | - | |
| 247 | + | |
| 248 | + | |
232 | 249 | | |
233 | 250 | | |
234 | 251 | | |
| |||
0 commit comments