Speed up linux ocserver to fix apparent instabilities.
authorMandeep Shetty <mandeep.shetty@intel.com>
Thu, 1 Oct 2015 00:55:50 +0000 (17:55 -0700)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Thu, 1 Oct 2015 19:01:43 +0000 (19:01 +0000)
commit803ff55105d01da080893b9c3dc4d9a26b6ab51f
treeb862fa5153deeb7c249f21449bfe98404d067b1e
parent5b1acfb3a398b5e73ce5696d99f86b5addfc3a2d
Speed up linux ocserver to fix apparent instabilities.

The linux ocserver had three threads running uncluding the main thread.
All three had sleeps in it and there was a delay of 2 seconds between
every call to OCProcess ().
This caused the ocserver to be slow and the server appeared to be
unstable specially when there were many clients sending in requests to
one server.

- Changed ocserver to start the observation thread only when observation
is requested similar to the C++ sample simpleserver.
- Removed the sleep between calls to OCProcess ()
- Moved stopping presence logic to the presence thread from the
  observation thread.

This may be cherrypicked to 1.0.0-dev.

Change-Id: Ib1c9fd732d0973435b556adb8a42610447f1ae7b
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3339
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp