Пример #1
0
        private static void OnLineReaded_writeNginx(object sender, LineReadedEventArgs e)
        {
            string meta;
            string requestData;
            string error;
            if (!lp.Process(e.Line, out meta, out requestData, out error))
            {
                WriteError(error);
            }

            lock (locker)
            {

                string key = meta.Replace('\t','^');

                /*if (!_sessions.Contains(key))
                {
                    _sessions.Add(key);
                    byte[] lineB1 = Encoding.Default.GetBytes(meta + "\r\n");
                    bf1.Write(lineB1, 0, lineB1.Length);
                }*/

                byte[] lineB2 = Encoding.Default.GetBytes(key + "\t" + requestData + "\r\n");

                GetFileStream(meta.Split('\t')[0]).Write(lineB2, 0, lineB2.Length);

                //bf.Write(CLRF,0,2);
            }
        }
Пример #2
0
 private static void OnLineReaded_writeSimple(object sender, LineReadedEventArgs e)
 {
     lock (locker)
     {
        Console.WriteLine(e.Line);
     }
 }
Пример #3
0
        private static void OnLineReaded_send(object sender, LineReadedEventArgs e)
        {
            lock (_list)//_wait.WaitOne();
            {
                byte[] mb = new NetworkMessage(e.Line).GetBytesForTransfer();

                //if (_list.Count > 1000)
                //    _wait.WaitOne();
                _list.Add(mb);
                Interlocked.Add(ref _totalMessageLength, mb.Length);

                if (_list.Count > 10000)
                {

                    Flush();
                    //_wait.Set();
                }

            }
        }