protected override void BuildHeader(SendBuffer sendBuffer, bool transformed)
        {
            uint header = (uint)(transformed ? 1 : 0);

            header |= ((uint)sendBuffer.Buffer.Length << 1);

            sendBuffer.HeaderLength = Serializer.WriteVariable(sendBuffer.HeaderBytes, header);

            Trace.Log("{0} {1} built {2}-byte header {3} | {4}",
                      link.Name, InternalHandle, sendBuffer.HeaderLength,
                      sendBuffer.Buffer.Length, transformed);
        }
Beispiel #2
0
        internal protected void OnSendInternal(int bytesTransferred)
        {
            Diag.AddBytesSent(bytesTransferred);

            lock (syncRoot)
            {
                if (disposed)
                {
                    txFlag = false;
                    return;
                }
            }

            if (Config.TraceLevel <= TraceLevel.Trace)
            {
                for (int i = 0; i < txBuffers.Count; ++i)
                {
                    SendBuffer sendBuffer = txBuffers[i];

                    Trace.Log("{0} {1} sent head {2}: {3}", link.Name,
                              InternalHandle, sendBuffer.HeaderLength,
                              BitConverter.ToString(sendBuffer.HeaderBytes, 0, sendBuffer.HeaderLength));
                    Trace.Log("{0} {1} sent body {2}: {3}", link.Name,
                              InternalHandle, sendBuffer.Buffer.Length,
                              sendBuffer.Buffer.ToHexString());
                }
            }

            Trace.Log("{0} {1} sent {2}/{3} byte(s)",
                      link.Name, InternalHandle, bytesTransferred, lengthToSend);

            lock (syncRoot)
            {
                if (eventsToSend.Count == 0)
                {
                    eventsSending.Clear();
                    txFlag = false;
                    return;
                }
            }

            BeginSend();
        }
Beispiel #3
0
 protected abstract void BuildHeader(SendBuffer sendBuffer, bool transformed);