Example #1
0
 /// <summary>
 /// Send a packet synchronously
 /// </summary>
 /// <param name="packet">SNI packet</param>
 /// <returns>SNI error code</returns>
 public uint Send(SNIPacket packet)
 {
     lock (this)
     {
         return(_lowerHandle.Send(packet));
     }
 }
Example #2
0
 /// <summary>
 /// Send a packet synchronously
 /// </summary>
 /// <param name="packet">SNI packet</param>
 /// <returns>SNI error code</returns>
 public uint Send(SNIPacket packet)
 {
     using (TrySNIEventScope.Create(nameof(SNIMarsConnection)))
     {
         lock (DemuxerSync)
         {
             return(_lowerHandle.Send(packet));
         }
     }
 }
Example #3
0
        /// <summary>
        /// Send a packet synchronously
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <returns>SNI error code</returns>
        public uint Send(SNIPacket packet)
        {
            long scopeID = SqlClientEventSource.Log.TrySNIScopeEnterEvent("<sc.SNI.SNIMarsConnection.Send |SNI|INFO|SCOPE> Send");

            try
            {
                lock (this)
                {
                    return(_lowerHandle.Send(packet));
                }
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }
Example #4
0
        /// <summary>
        /// Send a packet
        /// </summary>
        /// <param name="handle">SNI handle</param>
        /// <param name="packet">SNI packet</param>
        /// <param name="sync">true if synchronous, false if asynchronous</param>
        /// <returns>SNI error status</returns>
        internal uint WritePacket(SNIHandle handle, SNIPacket packet, bool sync)
        {
            uint result;

            if (sync)
            {
                result = handle.Send(packet);
                handle.ReturnPacket(packet);
            }
            else
            {
                result = handle.SendAsync(packet);
            }

            return(result);
        }
Example #5
0
        /// <summary>
        /// Send a packet
        /// </summary>
        /// <param name="handle">SNI handle</param>
        /// <param name="packet">SNI packet</param>
        /// <param name="sync">true if synchronous, false if asynchronous</param>
        /// <returns>SNI error status</returns>
        public uint WritePacket(SNIHandle handle, SNIPacket packet, bool sync)
        {
            uint result;

            if (sync)
            {
                result = handle.Send(packet);
                packet.Release();
            }
            else
            {
                result = handle.SendAsync(packet, true);
            }

            return(result);
        }
        /// <summary>
        /// Send a packet synchronously
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <returns>SNI error code</returns>
        public uint Send(SNIPacket packet)
        {
            long scopeID = SqlClientEventSource.Log.TrySNIScopeEnterEvent(s_className);

            try
            {
                lock (this)
                {
                    return(_lowerHandle.Send(packet));
                }
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }
Example #7
0
        /// <summary>
        /// Send a packet
        /// </summary>
        /// <param name="handle">SNI handle</param>
        /// <param name="packet">SNI packet</param>
        /// <param name="sync">true if synchronous, false if asynchronous</param>
        /// <returns>SNI error status</returns>
        public uint WritePacket(SNIHandle handle, SNIPacket packet, bool sync)
        {
            SNIPacket clonedPacket = packet.Clone();
            uint      result;

            if (sync)
            {
                result = handle.Send(clonedPacket);
                clonedPacket.Dispose();
            }
            else
            {
                result = handle.SendAsync(clonedPacket, true);
            }

            return(result);
        }
Example #8
0
        /// <summary>
        /// Send a packet
        /// </summary>
        /// <param name="handle">SNI handle</param>
        /// <param name="packet">SNI packet</param>
        /// <param name="sync">true if synchronous, false if asynchronous</param>
        /// <returns>SNI error status</returns>
        internal uint WritePacket(SNIHandle handle, SNIPacket packet, bool sync)
        {
            uint result;

            if (sync)
            {
                result = handle.Send(packet);
                handle.ReturnPacket(packet);
            }
            else
            {
                result = handle.SendAsync(packet);
            }

            SqlClientEventSource.Log.TryTraceEvent("SNIProxy.WritePacket | Info | Session Id {0}, SendAsync Result {1}", handle?.ConnectionId, result);
            return(result);
        }
        internal override uint WritePacket(PacketHandle packetHandle, bool sync)
        {
            uint      result;
            SNIHandle handle = Handle;
            SNIPacket packet = packetHandle.ManagedPacket;

            if (sync)
            {
                result = handle.Send(packet);
                handle.ReturnPacket(packet);
            }
            else
            {
                result = handle.SendAsync(packet);
            }

            SqlClientEventSource.Log.TryTraceEvent("TdsParserStateObjectManaged.WritePacket | Info | Session Id {0}, SendAsync Result {1}", handle?.ConnectionId, result);
            return(result);
        }