Ejemplo n.º 1
0
 /// <summary>
 /// Send a packet asynchronously
 /// </summary>
 /// <param name="packet">SNI packet</param>
 /// <param name="callback">Completion callback</param>
 /// <returns>SNI error code</returns>
 public uint SendAsync(SNIPacket packet, SNIAsyncCallback callback)
 {
     lock (this)
     {
         return(_lowerHandle.SendAsync(packet, false, callback));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Send a packet asynchronously
 /// </summary>
 /// <param name="packet">SNI packet</param>
 /// <param name="callback">Completion callback</param>
 /// <returns>SNI error code</returns>
 public uint SendAsync(SNIPacket packet, SNIAsyncCallback callback)
 {
     using (TrySNIEventScope.Create(nameof(SNIMarsConnection)))
     {
         lock (DemuxerSync)
         {
             return(_lowerHandle.SendAsync(packet, callback));
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Send a packet asynchronously
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <param name="callback">Completion callback</param>
        /// <returns>SNI error code</returns>
        public uint SendAsync(SNIPacket packet, SNIAsyncCallback callback)
        {
            long scopeID = SqlClientEventSource.Log.TrySNIScopeEnterEvent("<sc.SNI.SNIMarsConnection.SendAsync |SNI|INFO|SCOPE> SendAsync");

            try
            {
                lock (this)
                {
                    return(_lowerHandle.SendAsync(packet, callback));
                }
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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 asynchronously
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <param name="callback">Completion callback</param>
        /// <returns>SNI error code</returns>
        public uint SendAsync(SNIPacket packet, SNIAsyncCallback callback)
        {
            long scopeID = SqlClientEventSource.Log.TrySNIScopeEnterEvent(s_className);

            try
            {
                lock (this)
                {
                    return(_lowerHandle.SendAsync(packet, callback));
                }
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }