Use recv/send instead of read/write in order to prevent SIGPIPE on prematurely closed connections by specifing MSG_NOSIGNAL flag.
Don't insert the same object twice in the list of objects to be freed.