properly explaining each #pragma warning disable

massaging OSHttpRequestPump to not abort on exceptions...
0.6.0-stable
Dr Scofield 2008-06-30 11:57:47 +00:00
parent b0287a43bd
commit 313f7f60fd
16 changed files with 158 additions and 133 deletions

View File

@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers
/// </summary>
public enum OSHttpHandlerResult
{
Unprocessed,
Pass,
Handled,
Detached,

View File

@ -98,42 +98,54 @@ namespace OpenSim.Framework.Servers
{
OSHttpRequest req = null;
try {
while (true)
{
// get job to do
try {
// dequeue an OSHttpRequest from OSHttpServer's
// request queue
req = _queue.Dequeue();
// get list of registered handlers
// get a copy of the list of registered handlers
List<OSHttpHandler> handlers = _server.OSHttpHandlers;
// prune list and sort from most specific to least
// specific
// prune list and have it sorted from most
// specific to least specific
handlers = MatchHandlers(req, handlers);
// process req
// process req: we try each handler in turn until
// we are either out of handlers or get back a
// Handled or Detached
OSHttpHandlerResult rc = OSHttpHandlerResult.Unprocessed;
foreach(OSHttpHandler h in handlers)
{
OSHttpHandlerResult rc = h.Process(req);
// handler did not process the request, try
// next handler
rc = h.Process(req);
// Pass: handler did not process the request,
// try next handler
if (OSHttpHandlerResult.Pass == rc) continue;
// handler is taking over processing of
// request, we are done
// Detached: handler is taking over processing
// of request, we are done
if (OSHttpHandlerResult.Detached == rc) break;
// request was handled, we need to clean up
// TODO: cleanup :-)
if (OSHttpHandlerResult.Handled != rc)
{
// something went wrong
throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc));
}
// Handled: clean up
// response.KeepAlive = false;
// response.SendChunked = false;
break;
}
}
}
catch (Exception e)
{
_log.DebugFormat("[{0}] something went wrong: {1}", EngineID, e.ToString());
_log.ErrorFormat("[{0}] something went wrong: {1}, terminating this pump", EngineID, e.Message);
_log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString());
_log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message);
}
}
}

View File

@ -77,6 +77,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ".ncd";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".oob";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rfd"; // Not sure if we'll ever see this
// disable warning: we know Script is obsolete, but need to support it
// anyhow
#pragma warning disable 0612
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ".spt"; // Not sure if we'll ever see this
#pragma warning restore 0612
@ -102,6 +104,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
EXTENSION_TO_ASSET_TYPE[".ncd"] = (sbyte)AssetType.Notecard;
EXTENSION_TO_ASSET_TYPE[".oob"] = (sbyte)AssetType.Object;
EXTENSION_TO_ASSET_TYPE[".rfd"] = (sbyte)AssetType.RootFolder;
// disable warning: we know Script is obsolete, but need to support it
// anyhow
#pragma warning disable 0612
EXTENSION_TO_ASSET_TYPE[".spt"] = (sbyte)AssetType.Script;
#pragma warning restore 0612

View File

@ -139,8 +139,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
#endregion
#region Event Definitions IGNORE
#pragma warning disable 67
// disable warning: public events constituting public API
#pragma warning disable 67
public event Action<IClientAPI> OnLogout;
public event ObjectPermissions OnObjectPermissions;
@ -294,8 +295,8 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning;
public event UpdateVector OnAutoPilotGo;
#pragma warning restore 67
#endregion
#region Overrriden Methods IGNORE

View File

@ -43,6 +43,7 @@ namespace OpenSim.Region.Examples.SimpleModule
private short count = 0;
private short frame = 0;
// disable warning: public events, part of the public API
#pragma warning disable 67
public event Action<IClientAPI> OnLogout;

View File

@ -100,6 +100,7 @@ namespace OpenSim.Region.Physics.Manager
public delegate void CollisionUpdate(EventArgs e);
public delegate void OutOfBounds(PhysicsVector pos);
// disable warning: public events
#pragma warning disable 67
public event PositionUpdate OnPositionUpdate;
public event VelocityUpdate OnVelocityUpdate;

View File

@ -193,8 +193,9 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X);
}
// mono compiler moans about overloading operators hiding base
// operator but should not according to C# language spec
// disable warning: mono compiler moans about overloading
// operators hiding base operator but should not according to C#
// language spec
#pragma warning disable 0108
public static Vertex operator *(Vertex v, Quaternion q)
{

View File

@ -127,8 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// No unbound free variables, so we only filled one bag. If empty, bagof fails.
if (_findallBagArray.Count > 0)
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in bagArrayVariable.unify(_findallBagArray))
yield return false;
@ -139,8 +139,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables)
{
// disable warning on l1 and l2, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key))
{
@ -161,8 +161,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public IEnumerable<bool> result(object Bag)
{
Variable bagArrayVariable = new Variable();
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in resultArray(bagArrayVariable))
{
@ -181,8 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public IEnumerable<bool> resultSet(object Bag)
{
Variable bagArrayVariable = new Variable();
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in resultArray(bagArrayVariable))
{
@ -198,8 +198,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable<bool> goalIterator, Variable bagArrayVariable)
{
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in goalIterator)
bagOfAnswers.add();
@ -211,8 +211,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
{
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in goalIterator)
bagOfAnswers.add();
@ -224,8 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
{
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in goalIterator)
bagOfAnswers.add();

View File

@ -59,8 +59,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor2 argFunctor = (Functor2)arg;
if (_name.Equals(argFunctor._name))
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
{
@ -72,8 +72,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
else if (arg is Variable)
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this))
yield return false;

View File

@ -61,8 +61,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor3 argFunctor = (Functor3)arg;
if (_name.Equals(argFunctor._name))
{
// disable warning on l1, l2, l3 don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
{
@ -77,8 +77,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
else if (arg is Variable)
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this))
yield return false;

View File

@ -44,8 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false;
}
// disable warning about unused variables: the following code
// is infested with it.
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168, 0219
// Debug: Hand-modify this central predicate to do tail recursion.

View File

@ -92,8 +92,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
else
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(this, arg))
yield return false;

View File

@ -572,8 +572,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Name = new Variable();
Variable ArgList = new Variable();
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in new ListPair(Name, ArgList).unify(List))
{
@ -601,8 +601,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (!(Term is Variable))
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term)))
{
@ -629,8 +629,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (argNumberInt >= 1 && argNumberInt <= termArgs.Length)
{
// The first ArgNumber is at 1, not 0.
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1]))
yield return false;
@ -826,8 +826,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object[] args = new object[] { Priority, Specifier, Operator };
foreach (object[] answer in _operatorTable)
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unifyArrays(args, answer))
yield return false;
@ -863,8 +863,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
int afterInt = atomAtom._name.Length - (beforeInt + lengthInt);
if (afterInt >= 0)
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(After, afterInt))
{
@ -1221,8 +1221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (arity == 2 && (name == Atom.a(",") || name == Atom.a(";") || name == Atom.DOT))
return false;
// Use the same mapping to static predicates in YP as the compiler.
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable()))
return false;
@ -1366,8 +1366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
foreach (NameArity key in _predicatesStore.Keys)
{
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify
(new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity))
@ -1628,8 +1628,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (_exception != null)
{
bool didUnify = false;
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in YP.unify(_exception._term, Catcher))
{

View File

@ -209,8 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object[] functorArgs = YP.getFunctorArgs(Term);
Variable pred = new Variable();
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in ((CompilerState)State)._pred.match
(new object[] { functorName, functorArgs.Length, pred, Atom.a("det") }))
@ -232,8 +232,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object[] functorArgs = YP.getFunctorArgs(Term);
Variable pred = new Variable();
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in ((CompilerState)State)._pred.match
(new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") }))

View File

@ -69,8 +69,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
YP.tell(myCS_SW);
//Console.WriteLine("Mycode\n ===================================\n" + myCode+"\n");
// disable warning on l1, don't see how we can
// code this differently
// disable warning: don't see how we can code this differently short
// of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in Parser.parseInput(TermList))
{

View File

@ -59,6 +59,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private Scene m_Scene;
private IConfig m_ScriptConfig;
private Compiler m_Compiler;
// disable warning: need to keep a reference to XEngine.EventManager
// alive to avoid it being garbage collected
#pragma warning disable 414
private EventManager m_EventManager;
#pragma warning restore 414