Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

PRInt32 tmQueue::PostTransaction ( tmTransaction aTrans  ) 

Places the transaction passed in on the queue. Takes ownership of the transaction, deletes it in the destructor. A reply is created and sent to the client to indicate the success of the posting of the transaction.

The reply is sent for all cases, with the status field containing the return value.

>= 0 if the message was posted properly.

-1 if the client posting is not attached to this queue, if the transaction has been posted to the wrong queue or if an error occured when trying to add the post to the internal storage.

Definition at line 177 of file tmQueue.cpp.

References tmVector::Append(), tmTransaction::GetOwnerID(), tmTransaction::GetQueueID(), tmTransaction::Init(), IsAttached(), tmTransactionManager::SendTransaction(), and tmVector::Size().

Referenced by tmTransactionManager::HandleTransaction().


  PRInt32 status = -1;
  PRUint32 ownerID = aTrans->GetOwnerID();

  // if we are attached, have the right queue and have successfully
  //    appended the transaction to the queue, send the transaction
  //    to all the listeners.

  if (IsAttached(ownerID) && aTrans->GetQueueID() == mID)
    status = mTransactions.Append(aTrans);

  if (status >= 0) {
    // send the transaction to all members of mListeners except the owner
    PRUint32 size = mListeners.Size();
    PRUint32 id = 0;
    for (PRUint32 index = 0; index < size; index++) {
      id = (PRUint32)NS_PTR_TO_INT32(mListeners[index]);
      if (ownerID != id)
        mTM->SendTransaction(id, aTrans);

  tmTransaction trans;
  if (NS_SUCCEEDED(trans.Init(ownerID,
                              0))) {
    // send the reply
    mTM->SendTransaction(ownerID, &trans);
  return status;

Generated by  Doxygen 1.6.0   Back to index