Enabling Nagle algorithm on socket to prevent EPIPEs, moving debug logic into lib