|
|
| 59 |
"that there is no limit.", |
59 |
"that there is no limit.", |
| 60 |
UintegerValue (0), |
60 |
UintegerValue (0), |
| 61 |
MakeUintegerAccessor (&BulkSendApplication::m_maxBytes), |
61 |
MakeUintegerAccessor (&BulkSendApplication::m_maxBytes), |
| 62 |
MakeUintegerChecker<uint32_t> ()) |
62 |
MakeUintegerChecker<uint64_t> ()) |
| 63 |
.AddAttribute ("Protocol", "The type of protocol to use.", |
63 |
.AddAttribute ("Protocol", "The type of protocol to use.", |
| 64 |
TypeIdValue (TcpSocketFactory::GetTypeId ()), |
64 |
TypeIdValue (TcpSocketFactory::GetTypeId ()), |
| 65 |
MakeTypeIdAccessor (&BulkSendApplication::m_tid), |
65 |
MakeTypeIdAccessor (&BulkSendApplication::m_tid), |
|
|
| 86 |
} |
86 |
} |
| 87 |
|
87 |
|
| 88 |
void |
88 |
void |
| 89 |
BulkSendApplication::SetMaxBytes (uint32_t maxBytes) |
89 |
BulkSendApplication::SetMaxBytes (uint64_t maxBytes) |
| 90 |
{ |
90 |
{ |
| 91 |
NS_LOG_FUNCTION (this << maxBytes); |
91 |
NS_LOG_FUNCTION (this << maxBytes); |
| 92 |
m_maxBytes = maxBytes; |
92 |
m_maxBytes = maxBytes; |
|
|
| 175 |
|
175 |
|
| 176 |
while (m_maxBytes == 0 || m_totBytes < m_maxBytes) |
176 |
while (m_maxBytes == 0 || m_totBytes < m_maxBytes) |
| 177 |
{ // Time to send more |
177 |
{ // Time to send more |
| 178 |
uint32_t toSend = m_sendSize; |
178 |
|
|
|
179 |
// uint64_t to allow the comparison later. |
| 180 |
// the result is in a uint32_t range anyway, because |
| 181 |
// m_sendSize is uint32_t. |
| 182 |
uint64_t toSend = m_sendSize; |
| 179 |
// Make sure we don't send too many |
183 |
// Make sure we don't send too many |
| 180 |
if (m_maxBytes > 0) |
184 |
if (m_maxBytes > 0) |
| 181 |
{ |
185 |
{ |
| 182 |
toSend = std::min (m_sendSize, m_maxBytes - m_totBytes); |
186 |
toSend = std::min (toSend, m_maxBytes - m_totBytes); |
| 183 |
} |
187 |
} |
|
|
188 |
|
| 184 |
NS_LOG_LOGIC ("sending packet at " << Simulator::Now ()); |
189 |
NS_LOG_LOGIC ("sending packet at " << Simulator::Now ()); |
| 185 |
Ptr<Packet> packet = Create<Packet> (toSend); |
190 |
Ptr<Packet> packet = Create<Packet> (toSend); |
| 186 |
m_txTrace (packet); |
191 |
m_txTrace (packet); |