Getting callbacks from le_data_AddConnectionStateHandler seems to work on and off

Hello,

I’m trying to make an app that requires a data connection and prints a message when the device is connected. using le_data_AddConnectionStateHandler() I’ve registered two functions for a callback on any state change, but only one of them gets called. its always the first registered function that doesn’t get called, and even if there is only one registered function, it doesn’t get called either.
note that there is no data connection before the app starts.

can anyone tell my why it happens? am i doing something wrong?

update: after a restart the only function gets called is the first registered. why is it that only one function gets called?

Thanks in advance!

Code:
https://drive.google.com/drive/folders/1leKsApAYnOCkePVyn_HZxQWRyvALP0P-?usp=sharing

OUTPUT:

terminal 1, starting the app:

root@swi-mdm9x15:~# app restart das

terminal 2, output:

root@swi-mdm9x15:~# logread -f | grep “/tt”
Jul 31 08:46:45 swi-mdm9x15 user.info Legato: INFO | supervisor[489]/supervisor T=main | app.c CreateFileLink() 1549 | Skipping file link ‘/legato/systems/current/apps/das/read-only/bin/tt’ to ‘/legato/systems/current/appsWriteable/das/bin/tt’: Already exists
Jul 31 08:46:45 swi-mdm9x15 user.debug Legato: DBUG | ttExe[16484]/tt_exe T=main | _main.c main() 63 | == Starting Event Processing Loop ==
Jul 31 08:46:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 51 | trying to init data connection
Jul 31 08:46:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 54 | OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO test2 = 268435457
Jul 31 08:46:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 55 | OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO test1 = 268435459
Jul 31 08:46:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:46:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c csh_waitForConnection() 26 | TESTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT222222222222222222222222222222222222222222222
Jul 31 08:46:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c csh_waitForConnection() 29 | test2 connected!!!.
Jul 31 08:46:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:47:05 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:47:15 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:47:25 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:47:35 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:47:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:47:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:48:05 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:48:15 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:48:25 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:48:35 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:48:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:48:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:49:05 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:49:15 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:49:25 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:49:35 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:49:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:49:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:50:05 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:50:15 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:50:25 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:50:35 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:50:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:50:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:51:05 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:51:15 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:51:25 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:51:35 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:51:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:51:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:52:05 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:52:15 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:52:25 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:52:35 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:52:45 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs
Jul 31 08:52:55 swi-mdm9x15 user.info Legato: INFO | ttExe[16484]/ttComp T=main | tt.c wait_for_connection() 62 | not connected yet, waiting 10secs

Hi almogalm,
May I ask which Legato framework version you are using?

In my case using 17.06, both callback is called, below logs in my test:

Aug 2 01:59:24 swi-mdm9x28 user.info Legato: INFO | modemDemo[18457]/demoComponent T=main | demo.c csh_waitForConnection() 26 | TESTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT222222222222222222222222222222222222222222222
Aug 2 01:59:24 swi-mdm9x28 user.info Legato: INFO | modemDemo[18457]/demoComponent T=main | demo.c csh_waitForConnection() 29 | test2 connected!!!.
Aug 2 01:59:24 swi-mdm9x28 user.debug Legato: DBUG | modemDemo[18457]/framework T=main | LE_FILENAME le_event_ServiceLoop() 1597 | epoll_wait() returned zero.
Aug 2 01:59:24 swi-mdm9x28 user.info Legato: INFO | modemDemo[18457]/demoComponent T=main | demo.c wait_for_connection() 62 | not connected yet, waiting 10secs
Aug 2 01:59:34 swi-mdm9x28 user.info Legato: INFO | modemDemo[18457]/demoComponent T=main | demo.c DcsStateHandler32() 44 | TESTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
Aug 2 01:59:34 swi-mdm9x28 user.info Legato: INFO | modemDemo[18457]/demoComponent T=main | demo.c DcsStateHandler32() 46 | test1 !!! got isConnected=1 !!!

Thx