public void Abort() { object locker = HTTPManager.Locker; lock (locker) { HTTPConnection connectionWith = HTTPManager.GetConnectionWith(this); if (connectionWith == null) { if (!HTTPManager.RemoveFromQueue(this)) { HTTPManager.Logger.Warning("HTTPRequest", "Abort - No active connection found with this request! (The request may already finished?)"); } this.State = HTTPRequestStates.Aborted; } else { if (this.Response != null && this.Response.IsStreamed) { this.Response.Dispose(); } connectionWith.Abort(HTTPConnectionStates.AbortRequested); } } }
/// <summary> /// Aborts an already estabilished connection, so no further download or upload are done. /// </summary> public void Abort() { lock (HTTPManager.Locker) { // Get the parent connection var connection = HTTPManager.GetConnectionWith(this); // No Connection found for this request, maybe not even started if (connection == null) { // so try to remove from the request queue if (!HTTPManager.RemoveFromQueue(this)) { HTTPManager.Logger.Warning("HTTPRequest", "Abort - No active connection found with this request! (The request may already finished?)"); } this.State = HTTPRequestStates.Aborted; } else { // destroy the incomplete response if (Response != null && Response.IsStreamed) { Response.Dispose(); } // send an abort request to the connection connection.Abort(HTTPConnectionStates.AbortRequested); } } }
public bool MoveNext() { lock (HTTPManager.Locker) { HTTPConnection connection = HTTPManager.GetConnectionWith(this); return(connection != null && connection.State <= HTTPConnectionStates.WaitForRecycle); } }
public bool MoveNext() { object locker = HTTPManager.Locker; bool result; lock (locker) { HTTPConnection connectionWith = HTTPManager.GetConnectionWith(this); result = (connectionWith != null && connectionWith.State <= HTTPConnectionStates.WaitForRecycle); } return(result); }
/// <summary> /// Aborts an already estabilished connection, so no further download or upload are done. /// </summary> public void Abort() { lock (HTTPManager.Locker) { // Get the parent connection var connection = HTTPManager.GetConnectionWith(this); if (connection == null) { UnityEngine.Debug.LogWarning("Abort - No active connection found with this request! (The download may already finished?)"); return; } connection.Abort(HTTPConnectionStates.AbortRequested); } }