Schedule delayed async session closing properly (without recurrence)
Fix double capture of this in async method registering, that was causing
compilation error for Android
Fix minor compiler warning in jsonapi-generator
This method is called from other threads and apparently caused
a sporadic crash caought on Android.
See retroshare://forum?name=Got%20crash%20on%20Android%20with%20GDB%20backtrace&id=95de1451952d8c38cb1cdfdb85eed986&msgid=ac8c9d41f2cd0c9e8e290433c7f296fecb2d62b3
In Restbed one is not supposed to call session->yield outside the
threads controlled by Restbed. RetroShare JSON API async call were
calling session->yield from threads controlled by RetroShare all the
times, this caused crashes in some cases, like when the JSON API
socket timed out concurrently with the session->yield call .
To solve this problem session->yield from async
calls are now wrapped insto mService->schedule to ensure they are
executed on the right thread (aka one of the threads controlled by
Restbed).
While solving this issue I realized also that passing RsEvents as const
references around was quite limiting in cases where the event need to
be finally handled in another thread, in that case passing by const
reference the RsEvent needed to be copied by value into the thread
that process it, in this copy by value process the information of
which was the original specific type is lost, and then only the data
and methods from general RsEvents are available, unless the handler
does tricky stuff with type coercion etc. To solve this limitation
pass the events as std::shared_ptr<const RsEvent> seems the safer and
more elegant solution.
JavaScript represents all numbers in a double like manner thus it
treats 64 bit integers in an unsafe manner, to workaroud this problem
provide an alternative strin representation in JSON serialization
format so JavaScript clients can access the correct value someway.
As JSON have no probles with 64 bits integers keep supporting the integer
representation too.
See https://stackoverflow.com/a/34989371