             if (c2r_schedule.length > 0)
                 transfer_chunk(s_c, s_r, c2r_schedule.shift(), "Client");
         }
-        if (flush_id)
-            clearTimeout(flush_id);
-        flush_id = undefined;
+
         /* Call again when safe, if necessary. */
         if (r2c_schedule.length > 0 || c2r_schedule.length > 0)
             flush_id = setTimeout(flush, ui.rate_limit.when() * 1000);

                s_r.close();
            dispatchEvent(new Event(Event.COMPLETE));
        });

        log("Client: connecting to " + addr_c.host + ":" + addr_c.port + ".");
        s_c.connect(addr_c.host, addr_c.port);

                s_c.close();
            dispatchEvent(new Event(Event.COMPLETE));
        });
        s_r.addEventListener(ProgressEvent.SOCKET_DATA, relay_to_client);

        log("Tor: connecting to " + addr_r.host + ":" + addr_r.port + ".");
        s_r.connect(addr_r.host, addr_r.port);
