Skip to content

fix: avoid duplicate AfterAssemblyDataReceived callback for Assembly attribute 3#595

Open
MrAlaskan wants to merge 1 commit into
EIPStackGroup:masterfrom
MrAlaskan:fix/cipassembly-avoid-double-afterassemblydatareceived
Open

fix: avoid duplicate AfterAssemblyDataReceived callback for Assembly attribute 3#595
MrAlaskan wants to merge 1 commit into
EIPStackGroup:masterfrom
MrAlaskan:fix/cipassembly-avoid-double-afterassemblydatareceived

Conversation

@MrAlaskan

Copy link
Copy Markdown

Summary

This PR removes a duplicate AfterAssemblyDataReceived() callback for explicit SetAttributeSingle writes to Assembly Attribute 3.

Problem

The Assembly class installs a class-level PostSetCallback, and Assembly Attribute 3 is also created with the kPostSetFunc flag. As a result, SetAttributeSingle() calls the attribute decoder first and then invokes the class-level post-set callback for the same write.

However, DecodeCipAssemblyAttribute3() already calls AfterAssemblyDataReceived(instance) after copying the new Assembly data. The Assembly class post-set callback AssemblyPostSetCallback() also calls AfterAssemblyDataReceived(instance). This means that one explicit SetAttributeSingle(Attribute 3) request deterministically produces two application-level data-received notifications for the same write.

This duplicates side effects for applications that use AfterAssemblyDataReceived() to trigger state changes, hardware updates, counters, logging, or other non-idempotent processing. It also makes the explicit write path inconsistent with the intended one-request, one-update event model.

Changes

  • Remove kPostSetFunc from Assembly Attribute 3 when the attribute is created in CreateAssemblyObject().
  • Keep the existing AfterAssemblyDataReceived() call inside DecodeCipAssemblyAttribute3() so that successful explicit writes still notify the application once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant