                 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);

            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);

    private function client_connected(e:Event):void
    {
        log("Client: connected.");
    }

    private function transfer_chunk(s_from:Socket, s_to:Socket, n:uint,
