Example #1
0
        public int /*0=suc, 1=fail, 2=full, 3=suc almost full, 4=too fast*/ DrawPaths(PathModel[] models, string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            if (Limiter.IsOverRate(Context.ConnectionId))
            {
                return(4);
            }

            // Order inversion may happen when current paths are still under processing and next paths rush in in a new thread.
            // This causes later path gets smaller gsid.

            int ret = 0;
            //Trace.TraceInformation("DrawPaths. models.Length={0}.", models.Length);

            string batch_uri  = null;
            int    batch_gsid = 0;

            for (int i = 0; i < models.Length; i++)
            {
                PathModel model = models[i];

                if (model.Type == (int)PathType.PT_BATCH)
                {
                    if (model.DxDyCombined == batch_uri)
                    {
                        model.Gsid = batch_gsid;
                    }
                    else
                    {
                        model.Gsid = GsidManager.Get(canonical_room_name);                                      // Negative and 0 GSIDs are also valid.
                        batch_gsid = model.Gsid;
                        batch_uri  = model.DxDyCombined;

                        // make all flag paths have same gsid. Otherwise path orders are affected by flag path's GSID. Batch path's order should depend on subid only.
                    }
                }
                else
                {
                    model.Gsid = GsidManager.Get(canonical_room_name);                                  // Negative and 0 GSIDs are also valid.
                }
                int r = DrawAPath5(model, canonical_room_name);
                if (r != 0)
                {
                    ret = r;
                }
            }
            return(ret);
        }
Example #2
0
 protected void Application_End()
 {
     GsidManager.Save(null);
 }