internal IPromise <Nothing> Dispatch(PlayerHandle client, Message eventMsg) { ARequest request = ARequest.Parse(client, this.server, eventMsg); if (request == null) { Log.Warning("Failed to parse request from {name}/{hash}/{address}: {msg_name} \"{msg_data}\"", client.Name, client.Stream.ConnectionHash, client.Stream.ConnectionEndpoint, eventMsg.name, eventMsg.DebugDescription()); return(Nothing.Resolved()); } if (!request.Validate(client, this.server)) { Log.Warning("Failed to validate request from {name}/{hash}/{address}: {msg_name} \"{msg_data}\"", client.Name, client.Stream.ConnectionHash, client.Stream.ConnectionEndpoint, eventMsg.name, eventMsg.DebugDescription()); return(Nothing.Resolved()); } Log.Verbose("<= {player}@{lobby} {event_description}", client.Digest, client.CurrentLobbyIdentifier, request.DebugDescription()); return(request.Process(client, this.server)); }
private void RunRequests() { while (true) { byte[] idata = null; bool found = false; AssetStorage foundAsset = null; ARequest req = this._assetRequests.Dequeue(); IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); if (result.Count > 0) { foundAsset = (AssetStorage)result.Next(); found = true; } AssetBase asset = new AssetBase(); if (found) { asset.FullID = foundAsset.UUID; asset.Type = foundAsset.Type; asset.InvType = foundAsset.Type; asset.Name = foundAsset.Name; idata = foundAsset.Data; } else { asset.FullID = LLUUID.Zero; } asset.Data = idata; _receiver.AssetReceived(asset, req.IsTexture); } }
public void Execute(ARequest request) { //Queue the request lock (this._requestLock) { _requestQueue.Add(request); } this._WorkerThread.TriggerWorker(); }
public void RequestAsset(LLUUID assetID, bool isTexture) { ARequest req = new ARequest(); req.AssetID = assetID; req.IsTexture = isTexture; this._assetRequests.Enqueue(req); }
public ARequest getAndRemoveRequest() { ARequest tempReq = null; lock (this._requestLock) { if (_requestQueue.Count > 0) { tempReq = _requestQueue[0]; _requestQueue.Remove(tempReq); } } return(tempReq); }
// This method will be called when the worker thread is started. public void DoWork() { //forever while (this.Working) { Console.WriteLine("worker thread: wait for signal"); _TriggerWorker.WaitOne(); Console.WriteLine("worker thread: signal was set; number of requests is: " + _theExecutor.numberOfPendingRequests()); //assume at least one request is available: fetch the first one while ((_CurrentRequest = _theExecutor.getAndRemoveRequest()) != null) { //a request fetched; handle it Console.WriteLine("worker thread: handle the request: " + _CurrentRequest.RemoteUrl); WebRequest webRequest = HttpWebRequest.Create(_CurrentRequest.RemoteUrl); webRequest.ContentType = _CurrentRequest.ContentType; webRequest.Method = _CurrentRequest.RequestMethod; webRequest.Timeout = 5000; this._CurrentResponse = null; try { this._CurrentResponse = webRequest.GetResponse() as HttpWebResponse; } catch (WebException ex) { this._CurrentRequest.SetRequestFailed("Web request failed"); } if (this._CurrentResponse != null) { if (this._CurrentResponse.StatusCode != HttpStatusCode.OK) { this._CurrentRequest.SetRequestFailed("Invalid return status code: " + this._CurrentResponse.StatusCode); } StreamReader reader = new StreamReader(this._CurrentResponse.GetResponseStream()); string content = reader.ReadToEnd(); if (string.IsNullOrWhiteSpace(content)) { this._CurrentRequest.AddResponse("Response contained empty body..."); } else { this._CurrentRequest.AddResponse(content); } } } } }
public AResponse SendRequest(ARequest request) { AResponse response = null; try { _historyControl.WriteToLog("Request: " + request.ParseToString()); response = _client.Send(request); _historyControl.WriteToLog("Response: " + response.ResponseType.ToString()); // update status SuccessPanel.BackColor = _statusColors[response.ResponseType]; } catch (System.Exception e) { _historyControl.WriteToLog("Error:" + e.Message); SuccessPanel.BackColor = _statusColors[ServerResponseType.Bad]; } return(response); }
private void OnAddonSetEvent(AAddon addon) { try { ARequest request = null; VisibleObject objectProperties = new VisibleObject(); switch (addon.Type) { case AddonType.D3dImage: request = new SetImageRequest(); ((SetImageRequest)request).Filename = ((ImageD3dVisibleAddon)addon).ImageFilename; objectProperties.Id = addon.Id; objectProperties.Layout = ((ImageD3dVisibleAddon)addon).Layout; ((SetImageRequest)request).ImageProperties = objectProperties; break; case AddonType.D3dText: request = new SetTextRequest(); ((SetTextRequest)request).Text = ((TextD3dVisibleAddon)addon).Text; objectProperties.Id = addon.Id; objectProperties.Layout = ((TextD3dVisibleAddon)addon).Layout; ((SetTextRequest)request).ObjectProperties = objectProperties; break; default: break; } _playerCommunicatorControl.SendRequest(request); } catch (System.Exception) { } }
public class UpdateHandler { public ZeeResponse Execute(ARequest request) { return(null); }
public AResponse Get(ARequest request) { // Request is ok in entry point. // Use ResolveService<T> here not TryResolve<T> var srvResp = ResolveService <ServiceB>().Get(new BRequest {
public AResponse ProcessMessage(ARequest content) { //todo }
public void OnIConnectSendListenerFailure(ARequest p0, AError p1) { OnFailure(p0, p1); }
public BRequest(ARequest source) { this.BText = source.AText; this.BProductKey = source.AProductKey; this.BSettings = source.ASettings; }