Beispiel #1
0
		// we are on our own thread from the IOCP thread pool:
		void dispatcher(uint pIndex) {
			CmdContext _cmdCtx = null;
			try {
				_cmdCtx = CmdContextCache.Get(pIndex);

				var _cmd = commandFactory.GetCommand(_cmdCtx.DataReceived);
				_cmd.Execute();
				_cmd.SendResponse(localHost, _cmdCtx.RmtEndPoint);
			}
			catch (Exception _ex) {
				log(LogSeverity.Critical, UDP_SERVER_DISPATCHER_LABEL, string.Format("Exception:\r\n{0}", _ex));
				if (_cmdCtx != null) {
					log(LogSeverity.Status, UDP_SERVER_DISPATCHER_LABEL, string.Format("Exception:\r\n{0}", _cmdCtx.DataReceived));
				}
			}
			finally {
				CmdContextCache.Remove(pIndex);
			}
		}