connection: Refactor out closure allocation

Moves the common/similar bits into one place.

This has a minor functional change - count and message are now initialized
immediately, previously they'd only be set if (de)marshal was successful.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
1 file changed