m + marshal and unmarshal registry table

Signed-off-by: Mattias Andrée <maandree@operamail.com>
prepare for handling client closed messages

Signed-off-by: Mattias Andrée <maandree@operamail.com>
unregister protocols for closing servers

Signed-off-by: Mattias Andrée <maandree@operamail.com>
reduce code complexity

Signed-off-by: Mattias Andrée <maandree@operamail.com>