Skip to content

Commit 1db8318

Browse files
authored
Fix bug with repeated log event subscription (#439)
The bug was caused by the alreadySubscribedToEvents flag not being set after a successful log event subscription. This meant that plc_tag_register_logger() could be called multiple times, causing an error.
1 parent 6851c39 commit 1db8318

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/libplctag/LibPlcTag.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static private void ensureSubscribeToEvents()
6666
var statusAfterRegistration = (Status)_native.plc_tag_register_logger(loggerDelegate);
6767
if (statusAfterRegistration != Status.Ok)
6868
throw new LibPlcTagException(statusAfterRegistration);
69+
70+
alreadySubscribedToEvents = true;
6971
}
7072

7173
static void invokeLogEvent(int tag_id, int debug_level, string message)

0 commit comments

Comments
 (0)