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 18:31:33 +0000 (18:31 +0000)
commit758e307a204b5b66dbf81ab6ed73463d7024f44d
treedafe3e138537385ef1a4918dac1985cf382be806
parentbee72560c33c5bb0148e06789b673aabcc91439c
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>
resource/csdk/stack/src/ocresource.c