Unverified Commit 9079f851 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

[skip-changelog] Pluggable monitor fix and refactor (#1482)

* Fixed race condition in pluggable monitor

Many methods had the stateLock held for the entire scope of the function
call but the 'port_closed' message can be received at any moment,
asyncronously, and it requires a stateLock as well. In this case the
worst case is that the decode loop is blocked for 10 seconds until the
timeout occurs, but this is not ideal.

This bug has been fixed by removing the state, since it's not really
useful.

* Improved message logging in pluggable monitor

* Refactored message processing in pluggable monitor

* Fix i18n

* fixed lint suggestion

* fix from code review
parent 3d5b4300
This diff is collapsed.
......@@ -2394,8 +2394,6 @@ msgstr "boardname"
#: arduino/discovery/discovery.go:375
#: arduino/discovery/discovery.go:392
#: arduino/discovery/discovery.go:415
#: arduino/monitor/monitor.go:252
#: arduino/monitor/monitor.go:370
msgid "calling %[1]s: %[2]w"
msgstr "calling %[1]s: %[2]w"
......@@ -2442,33 +2440,24 @@ msgstr "cleaning build path"
msgid "command"
msgstr "command"
#: arduino/monitor/monitor.go:157
msgid "command '%[1]s' failed: %[2]s"
msgstr "command '%[1]s' failed: %[2]s"
#: arduino/discovery/discovery.go:315
#: arduino/discovery/discovery.go:336
#: arduino/discovery/discovery.go:356
#: arduino/discovery/discovery.go:379
#: arduino/discovery/discovery.go:396
#: arduino/discovery/discovery.go:419
#: arduino/monitor/monitor.go:256
#: arduino/monitor/monitor.go:276
#: arduino/monitor/monitor.go:357
#: arduino/monitor/monitor.go:374
msgid "command failed: %s"
msgstr "command failed: %s"
#: arduino/monitor/monitor.go:355
msgid "communication out of sync, expected 'close', received '%s'"
msgstr "communication out of sync, expected 'close', received '%s'"
#: arduino/monitor/monitor.go:291
msgid "communication out of sync, expected 'configure', received '%s'"
msgstr "communication out of sync, expected 'configure', received '%s'"
#: arduino/monitor/monitor.go:274
msgid "communication out of sync, expected 'describe', received '%s'"
msgstr "communication out of sync, expected 'describe', received '%s'"
#: arduino/monitor/monitor.go:154
msgid "communication out of sync, expected '%[1]s', received '%[2]s'"
msgstr "communication out of sync, expected '%[1]s', received '%[2]s'"
#: arduino/discovery/discovery.go:313
#: arduino/monitor/monitor.go:254
msgid "communication out of sync, expected 'hello', received '%s'"
msgstr "communication out of sync, expected 'hello', received '%s'"
......@@ -2476,12 +2465,7 @@ msgstr "communication out of sync, expected 'hello', received '%s'"
msgid "communication out of sync, expected 'list', received '%s'"
msgstr "communication out of sync, expected 'list', received '%s'"
#: arduino/monitor/monitor.go:327
msgid "communication out of sync, expected 'open', received '%s'"
msgstr "communication out of sync, expected 'open', received '%s'"
#: arduino/discovery/discovery.go:377
#: arduino/monitor/monitor.go:372
msgid "communication out of sync, expected 'quit', received '%s'"
msgstr "communication out of sync, expected 'quit', received '%s'"
......@@ -2501,10 +2485,6 @@ msgstr "communication out of sync, expected 'stop', received '%s'"
msgid "computing hash: %s"
msgstr "computing hash: %s"
#: arduino/monitor/monitor.go:293
msgid "configure failed: %s"
msgstr "configure failed: %s"
#: commands/upload/upload.go:611
msgid "could not find a valid build artifact"
msgstr "could not find a valid build artifact"
......@@ -2967,10 +2947,6 @@ msgstr "no valid sketch found in %[1]s: missing %[2]s"
msgid "no versions available for the current OS"
msgstr "no versions available for the current OS"
#: arduino/monitor/monitor.go:329
msgid "open failed: %s"
msgstr "open failed: %s"
#: arduino/resources/checksums.go:72
#: arduino/resources/install.go:59
msgid "opening archive file: %s"
......@@ -3059,8 +3035,11 @@ msgstr "port"
msgid "port not found: %[1]s %[2]s"
msgstr "port not found: %[1]s %[2]s"
#: arduino/monitor/monitor.go:246
msgid "protocol version not supported: requested %[1]d, got %[2]d"
msgstr "protocol version not supported: requested %[1]d, got %[2]d"
#: arduino/discovery/discovery.go:317
#: arduino/monitor/monitor.go:258
msgid "protocol version not supported: requested 1, got %d"
msgstr "protocol version not supported: requested 1, got %d"
......@@ -3246,14 +3225,14 @@ msgstr "the platform has no releases"
msgid "the server responded with status %s"
msgstr "the server responded with status %s"
#: arduino/monitor/monitor.go:147
msgid "timeout waiting for message"
msgstr "timeout waiting for message"
#: arduino/discovery/discovery.go:216
msgid "timeout waiting for message from %s"
msgstr "timeout waiting for message from %s"
#: arduino/monitor/monitor.go:161
msgid "timeout waiting for message from monitor %s"
msgstr "timeout waiting for message from monitor %s"
#: arduino/cores/packagemanager/install_uninstall.go:165
msgid "tool %s is not managed by package manager"
msgstr "tool %s is not managed by package manager"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment