Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions model/quic-congestion-ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ QuicCongestionOps::OnPacketSent (Ptr<TcpSocketState> tcb,
{
NS_LOG_FUNCTION (this << packetNumber << isAckOnly);
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

tcbd->m_timeOfLastSentPacket = Now ();
tcbd->m_highTxMark = packetNumber;
Expand All @@ -104,7 +104,7 @@ QuicCongestionOps::OnAckReceived (Ptr<TcpSocketState> tcb,
NS_LOG_FUNCTION (this << rs);

Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

tcbd->m_largestAckedPacket = SequenceNumber32 (
ack.GetLargestAcknowledged ());
Expand Down Expand Up @@ -137,7 +137,7 @@ QuicCongestionOps::UpdateRtt (Ptr<TcpSocketState> tcb, Time latestRtt,
{
NS_LOG_FUNCTION (this);
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

// m_minRtt ignores ack delay.
tcbd->m_minRtt = std::min (tcbd->m_minRtt, latestRtt);
Expand Down Expand Up @@ -178,7 +178,7 @@ QuicCongestionOps::OnPacketAcked (Ptr<TcpSocketState> tcb,
{
NS_LOG_FUNCTION (this);
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

OnPacketAckedCC (tcbd, ackedPacket);

Expand All @@ -200,7 +200,7 @@ QuicCongestionOps::InRecovery (Ptr<TcpSocketState> tcb,
{
NS_LOG_FUNCTION (this << packetNumber.GetValue ());
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

return packetNumber <= tcbd->m_endOfRecovery;
}
Expand All @@ -211,7 +211,7 @@ QuicCongestionOps::OnPacketAckedCC (Ptr<TcpSocketState> tcb,
{
NS_LOG_FUNCTION (this);
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

NS_LOG_INFO ("Updating congestion window");
if (InRecovery (tcb, ackedPacket->m_packetNumber))
Expand Down Expand Up @@ -245,7 +245,7 @@ QuicCongestionOps::OnPacketsLost (
{
NS_LOG_LOGIC (this);
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");

auto largestLostPacket = *(lostPackets.end () - 1);

Expand All @@ -269,7 +269,7 @@ QuicCongestionOps::OnRetransmissionTimeoutVerified (
{
NS_LOG_FUNCTION (this);
Ptr<QuicSocketState> tcbd = dynamic_cast<QuicSocketState*> (&(*tcb));
NS_ASSERT_MSG (tcbd != 0, "tcb is not a QuicSocketState");
NS_ASSERT_MSG (tcbd, "tcb is not a QuicSocketState");
NS_LOG_INFO ("Loss state");
tcbd->m_cWnd = tcbd->m_kMinimumWindow;
tcbd->m_congState = TcpSocketState::CA_LOSS;
Expand Down
20 changes: 10 additions & 10 deletions model/quic-l4-protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ QuicL4Protocol::UdpBind (Ptr<QuicSocketBase> socket)
for (it = m_quicUdpBindingList.begin (); it != m_quicUdpBindingList.end (); ++it)
{
Ptr<QuicUdpBinding> item = *it;
if (item->m_quicSocket == socket and item->m_budpSocket == nullptr)
if (item->m_quicSocket == socket and !item->m_budpSocket)
{
Ptr<Socket> udpSocket = CreateUdpSocket ();
res = udpSocket->Bind ();
Expand All @@ -206,7 +206,7 @@ QuicL4Protocol::UdpBind6 (Ptr<QuicSocketBase> socket)
for (it = m_quicUdpBindingList.begin (); it != m_quicUdpBindingList.end (); ++it)
{
Ptr<QuicUdpBinding> item = *it;
if (item->m_quicSocket == socket and item->m_budpSocket6 == nullptr)
if (item->m_quicSocket == socket and !item->m_budpSocket6)
{
Ptr<Socket> udpSocket6 = CreateUdpSocket6 ();
res = udpSocket6->Bind ();
Expand All @@ -230,7 +230,7 @@ QuicL4Protocol::UdpBind (const Address &address, Ptr<QuicSocketBase> socket)
for (it = m_quicUdpBindingList.begin (); it != m_quicUdpBindingList.end (); ++it)
{
Ptr<QuicUdpBinding> item = *it;
if (item->m_quicSocket == socket and item->m_budpSocket == nullptr)
if (item->m_quicSocket == socket and !item->m_budpSocket)
{
Ptr<Socket> udpSocket = CreateUdpSocket ();
res = udpSocket->Bind (address);
Expand All @@ -247,7 +247,7 @@ QuicL4Protocol::UdpBind (const Address &address, Ptr<QuicSocketBase> socket)
for (it = m_quicUdpBindingList.begin (); it != m_quicUdpBindingList.end (); ++it)
{
Ptr<QuicUdpBinding> item = *it;
if (item->m_quicSocket == socket and item->m_budpSocket6 == nullptr)
if (item->m_quicSocket == socket and !item->m_budpSocket6)
{
Ptr<Socket> udpSocket6 = CreateUdpSocket ();
res = udpSocket6->Bind (address);
Expand Down Expand Up @@ -409,7 +409,7 @@ QuicL4Protocol::SetListener (Ptr<QuicSocketBase> sock)
{
NS_LOG_FUNCTION (this);

if (sock != nullptr and m_quicUdpBindingList.size () == 1)
if (sock and m_quicUdpBindingList.size () == 1)
{
m_isServer = true;
m_quicUdpBindingList.front ()->m_quicSocket = sock;
Expand Down Expand Up @@ -489,15 +489,15 @@ QuicL4Protocol::ForwardUp (Ptr<Socket> sock)
}
}

NS_LOG_LOGIC ((socket == nullptr));
NS_LOG_LOGIC ((!socket));
/*NS_LOG_INFO ("Initial " << header.IsInitial ());
NS_LOG_INFO ("Handshake " << header.IsHandshake ());
NS_LOG_INFO ("Short " << header.IsShort ());
NS_LOG_INFO ("Version Negotiation " << header.IsVersionNegotiation ());
NS_LOG_INFO ("Retry " << header.IsRetry ());
NS_LOG_INFO ("0Rtt " << header.IsORTT ());*/

if (header.IsInitial () and m_isServer and socket == nullptr)
if (header.IsInitial () and m_isServer and !socket)
{
NS_LOG_LOGIC (this << " Cloning listening socket " << m_quicUdpBindingList.front ()->m_quicSocket);
socket = CloneSocket (m_quicUdpBindingList.front ()->m_quicSocket);
Expand All @@ -506,13 +506,13 @@ QuicL4Protocol::ForwardUp (Ptr<Socket> sock)
socket->SetupCallback ();

}
else if (header.IsHandshake () and m_isServer and socket != nullptr)
else if (header.IsHandshake () and m_isServer and socket)
{
NS_LOG_LOGIC ("CONNECTION AUTHENTICATED - Server authenticated Client " << InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort () << "");
m_authAddresses.push_back (InetSocketAddress::ConvertFrom (from).GetIpv4 ()); //add to the list of authenticated sockets
}
else if (header.IsHandshake () and !m_isServer and socket != nullptr)
else if (header.IsHandshake () and !m_isServer and socket)
{
NS_LOG_LOGIC ("CONNECTION AUTHENTICATED - Client authenticated Server " << InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort () << "");
Expand Down Expand Up @@ -559,7 +559,7 @@ QuicL4Protocol::ForwardUp (Ptr<Socket> sock)
}

// Handle callback for the correct socket
if (!m_socketHandlers[socket].IsNull ())
if (!m_socketHandlers[socket].IsNull())
{
NS_LOG_LOGIC (this << " waking up handler of socket " << socket);
m_socketHandlers[socket] (packet, header, from);
Expand Down
4 changes: 2 additions & 2 deletions model/quic-l5-protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ QuicL5Protocol::DispatchSend (Ptr<Packet> data, uint64_t streamId)

Ptr<QuicStreamBase> stream = SearchStream (streamId);

if (stream == nullptr)
if (!stream)
{
CreateStream (QuicStream::SENDER, streamId);
}
Expand Down Expand Up @@ -282,7 +282,7 @@ QuicL5Protocol::DispatchRecv (Ptr<Packet> data, Address &address)
{
Ptr<QuicStreamBase> stream = SearchStream (sub.GetStreamId ());

if (stream != nullptr
if (stream
and (stream->GetStreamDirectionType () == QuicStream::RECEIVER
or stream->GetStreamDirectionType ()
== QuicStream::BIDIRECTIONAL))
Expand Down
57 changes: 29 additions & 28 deletions model/quic-socket-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ QuicSocketBase::GetTypeId (void)
// UintegerValue (0),
// MakeUintegerAccessor (&QuicSocketBase::m_stateless_reset_token),
// MakeUintegerChecker<uint128_t> ())
.AddAttribute ("AckDelayExponent", "Ack Delay Exponent",
.AddAttribute ("AckDelayExponent", "Ack Delay Exponent",
UintegerValue (3),
MakeUintegerAccessor (&QuicSocketBase::m_ack_delay_exponent),
MakeUintegerChecker<uint8_t> ())
Expand All @@ -168,7 +168,7 @@ QuicSocketBase::GetTypeId (void)
DoubleValue (9 / 8),
MakeDoubleAccessor (&QuicSocketState::m_kTimeReorderingFraction),
MakeDoubleChecker<double> (0))
.AddAttribute ("kUsingTimeLossDetection", "Whether time based loss detection is in use",
.AddAttribute ("kUsingTimeLossDetection", "Whether time based loss detection is in use",
BooleanValue (false),
MakeBooleanAccessor (&QuicSocketState::m_kUsingTimeLossDetection),
MakeBooleanChecker ())
Expand Down Expand Up @@ -618,19 +618,19 @@ QuicSocketBase::~QuicSocketBase (void)
NS_LOG_FUNCTION (this);

m_node = 0;
if (m_endPoint != nullptr)
if (m_endPoint)
{
NS_ASSERT (m_quicl4 != nullptr);
NS_ASSERT (m_endPoint != nullptr);
NS_ASSERT (m_quicl4);
NS_ASSERT (m_endPoint);
m_quicl4->DeAllocate (m_endPoint);
NS_ASSERT (m_endPoint == nullptr);
NS_ASSERT (!m_endPoint);
}
if (m_endPoint6 != nullptr)
if (m_endPoint6)
{
NS_ASSERT (m_quicl4 != nullptr);
NS_ASSERT (m_endPoint6 != nullptr);
NS_ASSERT (m_quicl4);
NS_ASSERT (m_endPoint6);
m_quicl4->DeAllocate (m_endPoint6);
NS_ASSERT (m_endPoint6 == nullptr);
NS_ASSERT (!m_endPoint6);
}
m_quicl4 = 0;
//CancelAllTimers ();
Expand Down Expand Up @@ -776,19 +776,19 @@ QuicSocketBase::Connect (const Address & address)

if (InetSocketAddress::IsMatchingType (address))
{
if (m_endPoint == nullptr)
if (!m_endPoint)
{
if (Bind () == -1)
{
NS_ASSERT (m_endPoint == nullptr);
NS_ASSERT (!m_endPoint);
return -1; // Bind() failed
}
NS_ASSERT (m_endPoint != nullptr);
NS_ASSERT (m_endPoint);
}
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ());
//SetIpTos (transport.GetTos ());
m_endPoint6 = nullptr;
// m_endPoint6 = nullptr;

// Get the appropriate local address and port number from the routing protocol and set up endpoint
/*if (SetupEndpoint () != 0)
Expand All @@ -809,17 +809,17 @@ QuicSocketBase::Connect (const Address & address)
return Connect (InetSocketAddress (v4Addr, transport.GetPort ()));
}

if (m_endPoint6 == nullptr)
if (!m_endPoint6)
{
if (Bind6 () == -1)
{
NS_ASSERT (m_endPoint6 == nullptr);
NS_ASSERT (!m_endPoint6);
return -1; // Bind() failed
}
NS_ASSERT (m_endPoint6 != nullptr);
NS_ASSERT (m_endPoint6);
}
m_endPoint6->SetPeer (v6Addr, transport.GetPort ());
m_endPoint = nullptr;
// m_endPoint = nullptr;

// Get the appropriate local address and port number from the routing protocol and set up endpoint
/*if (SetupEndpoint6 () != 0)
Expand All @@ -840,7 +840,7 @@ QuicSocketBase::Connect (const Address & address)
m_socketType = CLIENT;
}

if (m_quicl5 == 0)
if (!m_quicl5)
{
m_quicl5 = CreateStreamController ();
m_quicl5->CreateStream (QuicStream::BIDIRECTIONAL, 0); // Create Stream 0 (necessary)
Expand Down Expand Up @@ -1291,7 +1291,7 @@ QuicSocketBase::SendDataPacket (SequenceNumber32 packetNumber,
if (m_txBuffer->GetNumFrameStream0InBuffer () > 0)
{
p = m_txBuffer->NextStream0Sequence (packetNumber);
NS_ABORT_MSG_IF (p == 0, "No packet for stream 0 in the buffer!");
NS_ABORT_MSG_IF (!p, "No packet for stream 0 in the buffer!");
}
else
{
Expand Down Expand Up @@ -1661,13 +1661,13 @@ QuicSocketBase::RecvFrom (uint32_t maxSize, uint32_t flags,

Ptr<Packet> packet = m_rxBuffer->Extract (maxSize);

if (packet != nullptr && packet->GetSize () != 0)
if (packet && packet->GetSize () != 0)
{
if (m_endPoint != nullptr)
if (m_endPoint)
{
fromAddress = InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ());
}
else if (m_endPoint6 != nullptr)
else if (m_endPoint6)
{
fromAddress = Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ());
}
Expand Down Expand Up @@ -1857,7 +1857,7 @@ QuicSocketBase::SetupCallback (void)
{
NS_LOG_FUNCTION (this);

if (m_quicl4 == 0)
if (!m_quicl4)
{
return -1;
}
Expand Down Expand Up @@ -2066,6 +2066,10 @@ QuicSocketBase::SendInitialHandshake (uint8_t type,
Ptr<Packet> p = Create<Packet> ();
p->AddHeader (OnSendingTransportParameters ());

// Set initial congestion window and Ssthresh
m_tcb->m_cWnd = m_tcb->m_initialCWnd;
m_tcb->m_ssThresh = m_tcb->m_initialSsThresh;

m_quicl5->DispatchSend (p, 0);

}
Expand Down Expand Up @@ -2399,8 +2403,6 @@ QuicSocketBase::OnReceivedAckFrame (QuicSubheader &sub)
// try to send more data
SendPendingData (m_connected);

// Compute timers
SetReTxTimeout ();
}

QuicTransportParameters
Expand Down Expand Up @@ -2460,7 +2462,6 @@ QuicSocketBase::OnReceivedTransportParameters (
// TODO AbortConnection(QuicSubheader::TransportErrorCodes_t::TRANSPORT_PARAMETER_ERROR, "Invalid Initial Max Stream Id Uni value provided from Client");
return;
}

if (transportParameters.GetMaxPacketSize ()
< QuicSocketBase::MIN_INITIAL_PACKET_SIZE
or transportParameters.GetMaxPacketSize () > 65527)
Expand Down Expand Up @@ -2988,7 +2989,7 @@ void
QuicSocketBase::SetCongestionControlAlgorithm (Ptr<TcpCongestionOps> algo)
{
NS_LOG_FUNCTION (this << algo);
if (DynamicCast<QuicCongestionOps> (algo) != 0)
if (DynamicCast<QuicCongestionOps> (algo))
{
NS_LOG_INFO ("Non-legacy congestion control");
m_quicCongestionControlLegacy = false;
Expand Down
2 changes: 1 addition & 1 deletion model/quic-socket-factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ QuicSocketFactory::QuicSocketFactory ()
QuicSocketFactory::~QuicSocketFactory ()
{
NS_LOG_INFO ("Destroying QuicSocketFactory");
NS_ASSERT (m_quicl4 == 0);
NS_ASSERT (!m_quicl4);
}

void
Expand Down
Loading