rsmp 0.20.3 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6bfc3fc8bfbd9542d526cf49c4a5590672722ad628e12482458631d373f2a01
4
- data.tar.gz: 147774083ce7575ceab9bf4e5727b5a6838700b4daf6aa60b793921c193d2ebc
3
+ metadata.gz: d4c2f0ad26f341d78dba43980b9f873a75bf06d2233ffa3f27b30b3f7d83e297
4
+ data.tar.gz: 84187fc4d5c836233397ff20ffff5cdf236435069d3edb436999fe5f8de1436b
5
5
  SHA512:
6
- metadata.gz: dd734f66d888a71b8add0446d48dbbff7e10370eea8e852ed93a5aaa3e02de56bbdf0bbb92de2657b07c97e4b86bfa032af47848a6e163a6ddf09d05fd348249
7
- data.tar.gz: 5de9e95d0348ad2adff26d3d3b27f7b601cf7780442143142cc22fa2a6f658fff7bf1c5bf03af0c37b772012eb90f1e2cbb2c74282fe0f56b8db253165da443b
6
+ metadata.gz: 1950948c8087db84fbf12069e4fcee10160efa8e4031ba618dcbdf04c130104df5f6e8467f0cfdb647615ab5de3b96fcb7cc9cfeaf5ec458bc0471e9f09676e2
7
+ data.tar.gz: c9999221cc2b49d5320d2769230e8ba7c9e54bf5a4f4e37c7efdef599b7745f8d85dbb29c2ed7fc01304604e591a5303422e813e9dee978286760e3897705aa2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.20.3)
4
+ rsmp (0.20.4)
5
5
  async (~> 2.6.2)
6
6
  async-io (~> 1.35.0)
7
7
  colorize (~> 0.8.1)
@@ -45,7 +45,7 @@ module RSMP
45
45
  def find_component component_id, build: true
46
46
  component = @components[component_id]
47
47
  return component if component
48
- if build
48
+ if build && !component_id.empty?
49
49
  inferred = infer_component_type component_id
50
50
  component = inferred.new node: self, id: component_id
51
51
  @components[ component_id] = component
@@ -261,19 +261,31 @@ module RSMP
261
261
  end
262
262
 
263
263
  def process_command_request message
264
- log "Received #{message.type}", message: message, level: :log
265
264
  component_id = message.attributes["cId"]
266
- component = @site.find_component component_id
267
- commands = simplify_command_requests message.attributes["arg"]
268
- commands.each_pair do |command_code,arg|
269
- component.handle_command command_code,arg
270
- end
271
265
 
272
266
  rvs = message.attributes["arg"].map do |item|
273
267
  item = item.dup.merge('age'=>'recent')
274
268
  item.delete 'cO'
275
269
  item
276
270
  end
271
+
272
+ begin
273
+ component = @site.find_component component_id
274
+ commands = simplify_command_requests message.attributes["arg"]
275
+ commands.each_pair do |command_code,arg|
276
+ component.handle_command command_code,arg
277
+ end
278
+ log "Received #{message.type}", message: message, level: :log
279
+ rescue UnknownComponent => e
280
+ log "Received #{message.type} with unknown component id '#{component_id}'", message: message, level: :warning
281
+ # If the component is unknown, we must set age=undefined for all items,
282
+ # while still acknowledge the message.
283
+ # See https://github.com/rsmp-nordic/rsmp_validator/issues/271
284
+ rvs.map do |item|
285
+ item['age'] = 'undefined'
286
+ end
287
+ end
288
+
277
289
  response = CommandResponse.new({
278
290
  "cId"=>component_id,
279
291
  "cTS"=>clock.to_s,
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.20.3"
2
+ VERSION = "0.20.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.3
4
+ version: 0.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-04 00:00:00.000000000 Z
11
+ date: 2023-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async