Move the reader mainloop logic out of the functor

Signed-off-by: John Else <john.else@citrix.com>
Move the writer mainloop logic out of the functor

Signed-off-by: John Else <john.else@citrix.com>