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>
Tue, 6 Oct 2015 12:57:04 +0000 (12:57 +0000)
commitdbd8d9801a1e987df6e60e39c805498479903f6b
tree861814477da4c6c0b57001433b7ccd1a4cd6d587
parent18c3b9637f02e2df9c1e926d2e7cc508a276eafa
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/3533
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp