repaired network code (single-threaded reactor)