Secondary TCP connections do not get initial subscribed value as expected
waynepiekarski opened this issue · comments
I am using the latest ExtPlane master. I have noticed that with one connection, everything works fine, but if you have 2 or more connections, the initial value is not shown for "sub" commands.
For example, start up a terminal #1 with:
echo "sub sim/aircraft/view/acf_descrip" | nc $HOSTNAME 51000
You will see:
EXTPLANE 1
ub sim/aircraft/view/acf_descrip WmlibyBCb2VpbmcgNzM3LTgwMFg=
If you open a new terminal #2 with the same command, you will see:
EXTPLANE 1
In terminal #1, you will see it gets an update with the same value:
ub sim/aircraft/view/acf_descrip WmlibyBCb2VpbmcgNzM3LTgwMFg=
If you open a terminal #3, you will see terminal #1 and #2 get an update but #3 has no value.
So it seems like when a new connection requests a sub, the other connections get the value and not the requestor. There must be a bug in the code which sends the initial value to new subscribers. Once the value changes in X-Plane, then all listeners get the update correctly.
Sounds like a bug indeed. Will be studied and fixed. Thanks for reporting!
Does this happen with only data datarefs or all dataref types?
I just tried it with echo "sub sim/aircraft/engine/acf_num_engines" | nc $HOSTNAME 51000
and it has the same problem with not showing the value initially.
I also noticed that I don't seem to be able to get datarefs like sim/operation/misc/frame_rate_period
or sim/cockpit2/controls/flap_handle_deploy_ratio
... if I add [0] it does nothing, and if I remove the [0] it crashes the whole simulator. I am able to access these values as floats via UDP RREFs.
I found reason for the issue and have made a potential fix in branch 22-fix-secondary-connections
Could you try that and see if it helps?
Hi there. I tested your new branch out and it seems to work pretty well, and fixes up all the issues I have identified. Thanks for fixing this.
Are you planning on doing a v2 release some time?
I have merged the changes in the branch to master.
Problem with releases is that I mostly develop on Linux so I won't be making Mac & Windows build. With mxe it's possible to make automated Windows builds in Travis, but that's still WIP.
I think I have found another bug related to the array values are handled, filed as #26, which is not fixed by this patch. Thanks!