Example #1
0
        /// <summary>
        /// Send a DDM packet to the client.
        ///
        /// Ideally, we can do this with a single channel write.  If that doesn't
        /// happen, we have to prevent anybody else from writing to the channel
        /// until this packet completes, so we synchronize on the channel.
        ///
        /// Another goal is to avoid unnecessary buffer copies, so we write
        /// directly out of the JdwpPacket's ByteBuffer.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void sendAndConsume(JdwpPacket packet, ChunkHandler replyHandler) throws java.io.IOException
        internal virtual void sendAndConsume(JdwpPacket packet, ChunkHandler replyHandler)
        {
            if (mChan == null)
            {
                // can happen for e.g. THST packets
                Log.v("ddms", "Not sending packet -- client is closed");
                return;
            }

            if (replyHandler != null)
            {
                /*
                 * Add the ID to the list of outstanding requests.  We have to do
                 * this before sending the packet, in case the response comes back
                 * before our thread returns from the packet-send function.
                 */
                addRequestId(packet.id, replyHandler);
            }

            lock (mChan)
            {
                try
                {
                    packet.writeAndConsume(mChan);
                }
                catch (IOException ioe)
                {
                    removeRequestId(packet.id);
                    throw ioe;
                }
            }
        }
Example #2
0
 /// <summary>
 /// Send a packet to the debugger.
 ///
 /// Ideally, we can do this with a single channel write.  If that doesn't
 /// happen, we have to prevent anybody else from writing to the channel
 /// until this packet completes, so we synchronize on the channel.
 ///
 /// Another goal is to avoid unnecessary buffer copies, so we write
 /// directly out of the JdwpPacket's ByteBuffer.
 ///
 /// We must synchronize on "mChannel" before writing to it.  We want to
 /// coordinate the buffered data with mChannel creation, so this whole
 /// method is synchronized.
 /// </summary>
 /*lock*/
 internal void sendAndConsume(JdwpPacket packet)
 {
     if (mChannel == null)
     {
         /*
          * Buffer this up so we can send it to the debugger when it
          * finally does connect.  This is essential because the VM_START
          * message might be telling the debugger that the VM is
          * suspended.  The alternative approach would be for us to
          * capture and interpret VM_START and send it later if we
          * didn't choose to un-suspend the VM for our own purposes.
          */
         Log.d("ddms", "Saving packet 0x" + packet.id.toHexString());
         packet.movePacket(mPreDataBuffer);
     }
     else
     {
         packet.writeAndConsume(mChannel);
     }
 }
Example #3
0
		/// <summary>
		/// Send a packet to the debugger.
		/// 
		/// Ideally, we can do this with a single channel write.  If that doesn't
		/// happen, we have to prevent anybody else from writing to the channel
		/// until this packet completes, so we synchronize on the channel.
		/// 
		/// Another goal is to avoid unnecessary buffer copies, so we write
		/// directly out of the JdwpPacket's ByteBuffer.
		/// 
		/// We must synchronize on "mChannel" before writing to it.  We want to
		/// coordinate the buffered data with mChannel creation, so this whole
		/// method is synchronized.
		/// </summary>
		/*lock*/
		internal void sendAndConsume(JdwpPacket packet)
		{
			if (mChannel == null)
			{
				/*
				 * Buffer this up so we can send it to the debugger when it
				 * finally does connect.  This is essential because the VM_START
				 * message might be telling the debugger that the VM is
				 * suspended.  The alternative approach would be for us to
				 * capture and interpret VM_START and send it later if we
				 * didn't choose to un-suspend the VM for our own purposes.
				 */
				Log.d("ddms", "Saving packet 0x" + packet.id.toHexString());
				packet.movePacket(mPreDataBuffer);
			}
			else
			{
				packet.writeAndConsume(mChannel);
			}
		}
Example #4
0
		/// <summary>
		/// Send a DDM packet to the client.
		/// 
		/// Ideally, we can do this with a single channel write.  If that doesn't
		/// happen, we have to prevent anybody else from writing to the channel
		/// until this packet completes, so we synchronize on the channel.
		/// 
		/// Another goal is to avoid unnecessary buffer copies, so we write
		/// directly out of the JdwpPacket's ByteBuffer.
		/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void sendAndConsume(JdwpPacket packet, ChunkHandler replyHandler) throws java.io.IOException
		internal virtual void sendAndConsume(JdwpPacket packet, ChunkHandler replyHandler)
		{

			if (mChan == null)
			{
				// can happen for e.g. THST packets
				Log.v("ddms", "Not sending packet -- client is closed");
				return;
			}

			if (replyHandler != null)
			{
				/*
				 * Add the ID to the list of outstanding requests.  We have to do
				 * this before sending the packet, in case the response comes back
				 * before our thread returns from the packet-send function.
				 */
				addRequestId(packet.id, replyHandler);
			}

			lock (mChan)
			{
				try
				{
					packet.writeAndConsume(mChan);
				}
				catch (IOException ioe)
				{
					removeRequestId(packet.id);
					throw ioe;
				}
			}
		}