public override IAsyncResult BeginCreatePortMap(Mapping mapping, AsyncCallback callback, object asyncState) { PortMapAsyncResult pmar = new PortMapAsyncResult(mapping.Protocol, mapping.PublicPort, PmpConstants.DefaultLeaseTime, callback, asyncState); ThreadPool.QueueUserWorkItem(delegate { try { CreatePortMap(pmar.Mapping, true); pmar.Complete(); } catch (Exception e) { pmar.Complete(e); } }); return(pmar); }
public override IAsyncResult BeginDeletePortMap(Mapping mapping, AsyncCallback callback, object asyncState) { PortMapAsyncResult pmar = new PortMapAsyncResult(mapping, callback, asyncState); ThreadPool.QueueUserWorkItem(delegate { try { CreatePortMap(pmar.Mapping, false); pmar.Complete(); } catch (Exception e) { pmar.Complete(e); } }); return(pmar); }
public override void EndDeletePortMap(IAsyncResult result) { PortMapAsyncResult pmar = result as PortMapAsyncResult; pmar.AsyncWaitHandle.WaitOne(); }
void EndCreatePortMap(IAsyncResult result) { PortMapAsyncResult pmar = result as PortMapAsyncResult; pmar.AsyncWaitHandle.WaitOne(); }