server: minor code cleanup
Suggested by Yuya after
77f9e95fe3c4, this is mostly using named values for
stdio descriptors. The lockfile is also opened in binary mode when reading back
content from the child.
cbor: import CBORDecoder and CBOREncoder
And format the imports so it is cleaner.
Differential Revision: https://phab.mercurial-scm.org/D2978