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
while (true)
{
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}] OSHttpHandler problem: {1}", EngineID, e.ToString());
_log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message);
}
}
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);
}
}

View File

@ -77,9 +77,11 @@ 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
#pragma warning disable 0612
// 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
#pragma warning restore 0612
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ".sst"; // Not sure if we'll ever see this
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ".sfd"; // Not sure if we'll ever see this
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg";
@ -102,9 +104,11 @@ 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;
#pragma warning disable 0612
// 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
#pragma warning restore 0612
EXTENSION_TO_ASSET_TYPE[".sst"] = (sbyte)AssetType.Simstate;
EXTENSION_TO_ASSET_TYPE[".sfd"] = (sbyte)AssetType.SnapshotFolder;
EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound;

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,9 +193,10 @@ 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
#pragma warning disable 0108
// 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)
{
Matrix4 tm = q.computeMatrix();
@ -253,7 +254,7 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
v1.Z *= mul;
return v1;
}
#pragma warning restore 0108
#pragma warning restore 0108
public float dot(Vertex v)

View File

@ -127,27 +127,27 @@ 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
#pragma warning disable 0168
// 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;
#pragma warning restore 0168
#pragma warning restore 0168
}
}
else
{
foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables)
{
// disable warning on l1 and l2, don't see how we can
// code this differently
#pragma warning disable 0168
// 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))
{
foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value))
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
// Debug: Should we free memory of the answers already returned?
}
}
@ -161,15 +161,15 @@ 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
#pragma warning disable 0168
// 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))
{
foreach (bool l2 in YP.unify(Bag, ListPair.make((List<object>)bagArrayVariable.getValue())))
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
}
/// <summary>
@ -181,9 +181,9 @@ 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
#pragma warning disable 0168
// 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))
{
List<object> bagArray = (List<object>)bagArrayVariable.getValue();
@ -191,19 +191,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray)))
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
}
public static IEnumerable<bool> bagofArray
(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
#pragma warning disable 0168
// 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();
#pragma warning restore 0168
#pragma warning restore 0168
return bagOfAnswers.resultArray(bagArrayVariable);
}
@ -211,12 +211,12 @@ 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
#pragma warning disable 0168
// 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();
#pragma warning restore 0168
#pragma warning restore 0168
return bagOfAnswers.result(Bag);
}
@ -224,12 +224,12 @@ 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
#pragma warning disable 0168
// 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();
#pragma warning restore 0168
#pragma warning restore 0168
return bagOfAnswers.resultSet(Bag);
}

View File

@ -59,25 +59,25 @@ 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
#pragma warning disable 0168
// 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))
{
foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
}
}
else if (arg is Variable)
{
// disable warning on l1, don't see how we can
// code this differently
#pragma warning disable 0168
// 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;
#pragma warning restore 0168
#pragma warning restore 0168
}
}

View File

@ -61,9 +61,9 @@ 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
#pragma warning disable 0168
// 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))
{
foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
@ -72,17 +72,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false;
}
}
#pragma warning restore 0168
#pragma warning restore 0168
}
}
else if (arg is Variable)
{
// disable warning on l1, don't see how we can
// code this differently
#pragma warning disable 0168
// 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;
#pragma warning restore 0168
#pragma warning restore 0168
}
}

View File

@ -44,9 +44,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false;
}
// disable warning about unused variables: the following code
// is infested with it.
#pragma warning disable 0168, 0219
// 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.
public static IEnumerable<bool> read_tokens(object arg1, object arg2, object arg3)
@ -4457,6 +4457,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{ }
}
}
#pragma warning restore 0168
#pragma warning restore 0168
}
}

View File

@ -92,12 +92,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
else
{
// disable warning on l1, don't see how we can
// code this differently
#pragma warning disable 0168
// 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;
#pragma warning restore 0168
#pragma warning restore 0168
}
}

View File

@ -572,9 +572,9 @@ 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
#pragma warning disable 0168
// 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))
{
object[] args = ListPair.toArray(ArgList);
@ -588,7 +588,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return YP.unify(Term, Functor.make((Atom)YP.getValue(Name), args));
}
#pragma warning restore 0168
#pragma warning restore 0168
return YP.fail();
}
@ -601,15 +601,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (!(Term is Variable))
{
// disable warning on l1, don't see how we can
// code this differently
#pragma warning disable 0168
// 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)))
{
foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length))
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
}
else
throw new NotImplementedException("Debug: must finish functor/3");
@ -629,12 +629,12 @@ 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
#pragma warning disable 0168
// 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;
#pragma warning restore 0168
#pragma warning restore 0168
}
}
}
@ -826,12 +826,12 @@ 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
#pragma warning disable 0168
// 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;
#pragma warning restore 0168
#pragma warning restore 0168
}
}
@ -863,16 +863,16 @@ 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
#pragma warning disable 0168
// 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))
{
foreach (bool l2 in YP.unify
(Sub_atom, Atom.a(atomAtom._name.Substring(beforeInt, lengthInt))))
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
}
}
@ -1221,13 +1221,13 @@ 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
#pragma warning disable 0168
// 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;
// Debug: Do we need to check if name._module is null?
#pragma warning restore 0168
#pragma warning restore 0168
return true;
}
@ -1366,13 +1366,13 @@ 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
#pragma warning disable 0168
// 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))
yield return false;
#pragma warning restore 0168
#pragma warning restore 0168
}
}
@ -1628,15 +1628,15 @@ 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
#pragma warning disable 0168
// 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))
{
didUnify = true;
yield return false;
}
#pragma warning restore 0168
#pragma warning restore 0168
if (!didUnify)
throw _exception;

View File

@ -209,9 +209,9 @@ 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
#pragma warning disable 0168
// 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") }))
{
@ -220,7 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return true;
}
}
#pragma warning restore 0168
#pragma warning restore 0168
return false;
}
@ -232,9 +232,9 @@ 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
#pragma warning disable 0168
// 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") }))
{
@ -243,7 +243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return true;
}
}
#pragma warning restore 0168
#pragma warning restore 0168
return false;
}
@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// disable warning unused variables, the following code is
// infested with it.
#pragma warning disable 0168, 0219
#pragma warning disable 0168, 0219
/// <summary>
/// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction

View File

@ -69,9 +69,10 @@ 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
#pragma warning disable 0168
// 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))
{
foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode))
@ -84,7 +85,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
//YPCompiler.convertStringCodesCSharp(VFC);
}
}
#pragma warning restore 0168
#pragma warning restore 0168
YP.seen();
myCS_SW.Close();
YP.told();

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