This is a straight conversion, and does not make any attempt to be more asynchronous, as I don't know the protocol between them, but I expect there are ways to reduce the blocking.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/247/
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.