コード例 #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));
     }
 }
コード例 #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));
         }
     }
 }
コード例 #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);
            }
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #6
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(s_className);

            try
            {
                lock (this)
                {
                    return(_lowerHandle.SendAsync(packet, callback));
                }
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }
コード例 #7
0
ファイル: SNIProxy.cs プロジェクト: ph1294/SqlClient
        /// <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);
        }
コード例 #8
0
ファイル: SNIProxy.cs プロジェクト: vikas304/SqlClient
        /// <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);
        }
コード例 #9
0
        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);
        }