protected Cmd _SendAndWaitForResponse(TorControl.Commands type, byte[] cmd) { CheckThread(); Waiter w = new Waiter(); lock (waiters.SyncRoot) { SendCommand(type, cmd); waiters.Enqueue(w); } return (Cmd) w.Response; }
protected IList SendAndWaitForResponse(string s, string rest) { CheckThread(); Waiter w = new Waiter(); WriteDebug(">> " + s); lock (waiters.SyncRoot) { output.Write(s); output.Flush(); if (rest != null) WriteEscaped(rest); waiters.Enqueue(w); WriteDebug("added waiter: " + w.Id); } ArrayList lst = (ArrayList) w.Response; foreach (ReplyLine c in lst) { if (! c.Status.StartsWith("2")) throw new TorControlException("Error reply: " + c.Msg); } return lst; }