Fix duplicate observer registrations due to slow server or network.
authorMandeep Shetty <mandeep.shetty@intel.com>
Fri, 25 Sep 2015 20:52:54 +0000 (13:52 -0700)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Wed, 30 Sep 2015 23:09:52 +0000 (23:09 +0000)
commit2ee6970bbce11c251e7c96ae11a925d1113f84ba
treef053766369296e223c63f276c5717aff85ed1850
parentaca1fefb75c06e58bcb3a79bd8d6629ef8182985
Fix duplicate observer registrations due to slow server or network.

This fixes IOT-720 and IOT-612.

The client retransmits a confirmable request before the 1st timeout for
un-acknowledged confirmable request. The server is occasionally too slow
to respond or the network is slow sometimes.
In case of OBSERVE registrations, a retransmit means two or more  observers will
be added for one observe request the client sent.
This leads to lot's of extra notifications being sent out and only one
of observers from the multiple clones are deleted if the client
de-registers.

Fix is to check with the token if observer was already added and ignore
the request if it was as the client was likely already ACKED for the
first request the server fully processed.

This should be cherrypicked to 1.0.0-dev.

Change-Id: I7ecfe1a6e8009606a9430515cbcedef2516507d7
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3155
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
(cherry picked from commit 758e307a204b5b66dbf81ab6ed73463d7024f44d)
Reviewed-on: https://gerrit.iotivity.org/gerrit/3325
resource/csdk/stack/src/ocresource.c