Node.MessageProcessor ProcessMessageWrap(Node.MessageProcessor messageProcessor) { return((str, n) => { if (n.IsClosed) { return; } n.UpdateUseTime(); messageProcessor(str, n); }); }
public static OverlayHost.ProcessorAssigner Convert(Game.ProcessorAssigner pa) { return((node, handshake) => { GameNodeProcessors gnp = pa(node, handshake); Node.MessageProcessor nmp = (stm, nd) => { //if (nd.IsClosed) done elsewhere // return; ChunkDebug lastRead = new ChunkDebug(stm); try { MessageType mt = Serializer.Deserialize <MessageType>(stm); if (nd.LogR != null && nd.LogR.LogLevel >= 2) { string sentMsg = mt.ToString(); if (MasterLog.LogLevel > 2) { sentMsg += lastRead.GetData() + "\n\n"; } Log.EntryVerbose(nd.LogR, sentMsg); } gnp.Message(mt, stm, nd); } catch (XmlSerializerException e) { Log.Console("Error while reading from socket:\n{0}\n\nLast read:{1}", e, lastRead.GetData()); throw new Exception("Fatal"); } }; return new NodeProcessors(nmp, gnp.Disconnect); }); }
public NodeProcessors(Node.MessageProcessor message, Node.DisconnectProcessor disconnect) { this.Message = message; this.Disconnect = disconnect; }