moved connection reading into child thread