public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out CreateAgentResponse response) { response = null; if (destination == null) { response = new CreateAgentResponse(); response.Reason = "Could not connect to destination"; response.Success = false; return false; } CreateAgentRequest request = new CreateAgentRequest(); request.CircuitData = aCircuit; request.Destination = destination; request.TeleportFlags = teleportFlags; AutoResetEvent resetEvent = new AutoResetEvent(false); OSDMap result = null; MainConsole.Instance.DebugFormat("[SimulationServiceConnector]: Sending Create Agent to " + destination.ServerURI); m_syncMessagePoster.Get(destination.ServerURI, request.ToOSD(), (osdresp) => { result = osdresp; resetEvent.Set(); }); bool success = resetEvent.WaitOne(10000); if (!success || result == null) { response = new CreateAgentResponse(); response.Reason = "Could not connect to destination"; response.Success = false; return false; } response = new CreateAgentResponse(); response.FromOSD(result); if (!response.Success) return false; return response.Success; }