Subject: [dtn-users] Bug found in Registration.cc - patch attached

From: Elwyn Davies <[email-masked]>
Date: Wed, 30 Jan 2013 14:57:01 +0000

Hi.

While testing some other stuff, I discovered that the changes that were
made to introduce 'replay_actions' into Registrations (changeset 3518)
missed a couple of things.
- replay_actions_ and delivery_acking_ are not in the serialize method
- the 'Builder' constructor, which is used mostly when reading stored
  registrations back from persistent store at startup, doesn't]
  initialize replay_actions_, delivery_acking_ or session_flags_.

The result is that for any Registrations that have a lifetime that makes
them persistent across restarts will have random values in the
replay_actions and delivery_acking_ fields after restart.  If you are
unlucky, this may trigger an assert in
APIRegistration::set_active_callback   
(It did for me!)

The attached patch fixes the problem.

An additional item which I will fix shortly is that theese fields are
not accessible through the scripting API, but that's not so urgent.

Regards
Elwyn

COMMIT NARRATIVE:

Ensure extra fields from Changeset 3518 in Registration structure are
stored and restored correctly.

Fixes:
- Add replay_actions_ and delivery_acking_ to fields processed in
  Registration::serialize
- Add initializers for replay_actions_, delivery_acking_ and
  session_flags_ to Registration::Registration(const oasys::Builder&)

diff -r 480758b2ff34 servlib/reg/Registration.cc
--- a/servlib/reg/Registration.cc	Fri Jan 18 23:27:41 2013 +0000
+++ b/servlib/reg/Registration.cc	Wed Jan 30 14:25:20 2013 +0000
@@ -90,6 +90,9 @@
       regid_(0),
       endpoint_(),
       failure_action_(DEFER),
+      replay_action_(NEW),
+      session_flags_(0),
+      delivery_acking_(false),
       script_(),
       expiration_(0),
       creation_time_(0),
@@ -165,7 +168,9 @@
     a->process("endpoint", &endpoint_);
     a->process("regid", &regid_);
     a->process("failure_action", &failure_action_);
+    a->process("replay_action", &replay_action_);
     a->process("session_flags", &session_flags_);
+    a->process("delivery_acking", &delivery_acking_);
     a->process("script", &script_);
     a->process("creation_time", &creation_time_);
     a->process("expiration", &expiration_);