From fb40e4b8b48cb71d3549da7afafe41bc749209b6 Mon Sep 17 00:00:00 2001 From: "l." Date: Thu, 29 May 2014 22:51:05 -0700 Subject: [PATCH] bug 1912: avoid multiple MacTxMiddle instances --- src/wifi/model/ap-wifi-mac.cc | 1 + src/wifi/model/dca-txop.cc | 7 +++++-- src/wifi/model/dca-txop.h | 6 ++++++ src/wifi/model/regular-wifi-mac.cc | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index eebc9bb9c..41276c151 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -81,6 +81,7 @@ ApWifiMac::ApWifiMac () m_beaconDca->SetMaxCw (0); m_beaconDca->SetLow (m_low); m_beaconDca->SetManager (m_dcfManager); + m_beaconDca->SetTxMiddle (m_txMiddle); // Let the lower layers know that we are acting as an AP. SetTypeOfStation (AP); diff --git a/src/wifi/model/dca-txop.cc b/src/wifi/model/dca-txop.cc index 9d19b158b..e26f0b8c6 100644 --- a/src/wifi/model/dca-txop.cc +++ b/src/wifi/model/dca-txop.cc @@ -145,7 +145,6 @@ DcaTxop::DcaTxop () m_dcf = new DcaTxop::Dcf (this); m_queue = CreateObject (); m_rng = new RealRandomStream (); - m_txMiddle = new MacTxMiddle (); } DcaTxop::~DcaTxop () @@ -163,7 +162,6 @@ DcaTxop::DoDispose (void) delete m_transmissionListener; delete m_dcf; delete m_rng; - delete m_txMiddle; m_transmissionListener = 0; m_dcf = 0; m_rng = 0; @@ -178,6 +176,11 @@ DcaTxop::SetManager (DcfManager *manager) m_manager->Add (m_dcf); } +void DcaTxop::SetTxMiddle (MacTxMiddle *txMiddle) +{ + m_txMiddle = txMiddle; +} + void DcaTxop::SetLow (Ptr low) { diff --git a/src/wifi/model/dca-txop.h b/src/wifi/model/dca-txop.h index c550ae9d1..24f186579 100644 --- a/src/wifi/model/dca-txop.h +++ b/src/wifi/model/dca-txop.h @@ -101,6 +101,12 @@ public: * \param remoteManager WifiRemoteStationManager */ void SetWifiRemoteStationManager (Ptr remoteManager); + /** + * Set MacTxMiddle this DcaTxop is associated to. + * + * \param txMiddle MacTxMiddle + */ + void SetTxMiddle (MacTxMiddle *txMiddle); /** * \param callback the callback to invoke when a diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index bbabf11af..715886483 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -57,6 +57,7 @@ RegularWifiMac::RegularWifiMac () m_dca = CreateObject (); m_dca->SetLow (m_low); m_dca->SetManager (m_dcfManager); + m_dca->SetTxMiddle(m_txMiddle); m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this)); m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));