private static void NeMessageToSendSignalHandler(SignalTypeEnum signalType) { ToConsole("Received new message signal!"); _pollMessagesToSend = true; WaitHandle.Set(); }
private static void NewPartialPacketsToMergeSignalHandler(SignalTypeEnum signalType) { ToConsole("Received signal to process new message!"); _pollPartialPackets = true; WaitHandle.Set(); }
private static void QuitSignalHandler(SignalTypeEnum signalType) { ToConsole($"Received quit signal as '{signalType}'!"); _doQuit = true; WaitHandle.Set(); }
public static void IncreaseSignal(MongoConnection connection, string option, SignalTypeEnum signalType, double strength) { IMongoCollection <Signal> signalsCollection = connection.Database.GetCollection <Signal>(typeof(Signal).Name); FilterDefinition <Signal> filter = Builders <Signal> .Filter.Eq(signal => signal.Option, option) & Builders <Signal> .Filter.Eq(signal => signal.SignalType, signalType); long signalCount = signalsCollection.CountAsync(filter).Result; if (signalCount == 0) { Signal signal = new Signal() { Option = option, SignalType = signalType, Strength = strength, }; Task insertTask = signalsCollection.InsertOneAsync(signal); insertTask.Wait(); } else { UpdateDefinition <Signal> update = Builders <Signal> .Update.Inc(signal => signal.Strength, strength); Task updateTask = signalsCollection.UpdateOneAsync(filter, update); updateTask.Wait(); } }
public Signal(Plugin plug, ushort join, string name, SignalTypeEnum signalType, SignalDirectionEnum signalDirection) { Plug = plug; Join = join; Name = name; SignalType = signalType; SignalDirection = signalDirection; Log = new List <SignalLogItem>(); }
public static void IncreaseSignal(MongoConnection connection, SignalTypeEnum signalType, double strength) { IMongoCollection <Signal> signalsCollection = connection.Database.GetCollection <Signal>(typeof(Signal).Name); FilterDefinition <Signal> filter = Builders <Signal> .Filter.Eq(signal => signal.SignalType, signalType); UpdateDefinition <Signal> update = Builders <Signal> .Update.Inc(signal => signal.Strength, strength); Task updateTask = signalsCollection.UpdateManyAsync(filter, update); updateTask.Wait(); }
public static Signal ReadSignal(MongoConnection connection, string option, SignalTypeEnum signalType) { IMongoCollection <Signal> collection = connection.Database.GetCollection <Signal>(typeof(Signal).Name); IFindFluent <Signal, Signal> signalFind = collection.Find(lSignal => lSignal.Option == option && lSignal.SignalType == signalType); Task <Signal> signals = signalFind.SingleOrDefaultAsync(); Signal signal = signals.Result; if (signal == null) { signal = new Signal() { Option = option, SignalType = SignalTypeEnum.Fail, Strength = 0d, }; } return(signal); }
public static bool Raise(SignalTypeEnum signal) { var result = raiseSignal((int)signal); return(result == 0); }
public static bool Send(int processID, SignalTypeEnum signal) { var result = sendSignal(processID, (int)signal); return(result == 0); }
private static void RedoCacheSignalHandler(SignalTypeEnum signalType) { ToConsole("Received signal to redo cache!"); BuildCache(); }