Handle custom keepalive modifications on the fly

It is possible for activity under 'raw_command' to modify custom
keepalive registry.  Tolerate the structure changing in the loop gracefully.

Change-Id: I99c99b52718dff518c303819e7a24085cc6fb97a