equal
deleted
inserted
replaced
78 m_lastRxAck (0), |
78 m_lastRxAck (0), |
79 m_nextRxSequence (0), |
79 m_nextRxSequence (0), |
80 m_pendingData (0), |
80 m_pendingData (0), |
81 m_rtt (0), |
81 m_rtt (0), |
82 m_lastMeasuredRtt (Seconds(0.0)), |
82 m_lastMeasuredRtt (Seconds(0.0)), |
83 m_rxAvailable (0), |
83 m_rxAvailable (0) |
84 m_wouldBlock (false) |
|
85 { |
84 { |
86 NS_LOG_FUNCTION (this); |
85 NS_LOG_FUNCTION (this); |
87 } |
86 } |
88 |
87 |
89 TcpSocketImpl::TcpSocketImpl(const TcpSocketImpl& sock) |
88 TcpSocketImpl::TcpSocketImpl(const TcpSocketImpl& sock) |
124 m_rtt (0), |
123 m_rtt (0), |
125 m_lastMeasuredRtt (Seconds(0.0)), |
124 m_lastMeasuredRtt (Seconds(0.0)), |
126 m_cnTimeout (sock.m_cnTimeout), |
125 m_cnTimeout (sock.m_cnTimeout), |
127 m_cnCount (sock.m_cnCount), |
126 m_cnCount (sock.m_cnCount), |
128 m_rxAvailable (0), |
127 m_rxAvailable (0), |
129 m_wouldBlock (false), |
|
130 m_sndBufSize (sock.m_sndBufSize), |
128 m_sndBufSize (sock.m_sndBufSize), |
131 m_rcvBufSize(sock.m_rcvBufSize) |
129 m_rcvBufSize(sock.m_rcvBufSize) |
132 { |
130 { |
133 NS_LOG_FUNCTION_NOARGS (); |
131 NS_LOG_FUNCTION_NOARGS (); |
134 NS_LOG_LOGIC("Invoked the copy constructor"); |
132 NS_LOG_LOGIC("Invoked the copy constructor"); |
354 NS_LOG_FUNCTION (this << p); |
352 NS_LOG_FUNCTION (this << p); |
355 if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT) |
353 if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT) |
356 { |
354 { |
357 if (p->GetSize() > GetTxAvailable ()) |
355 if (p->GetSize() > GetTxAvailable ()) |
358 { |
356 { |
359 m_wouldBlock = true; |
|
360 m_errno = ERROR_MSGSIZE; |
357 m_errno = ERROR_MSGSIZE; |
361 return -1; |
358 return -1; |
362 } |
359 } |
363 if (!m_pendingData) |
360 if (!m_pendingData) |
364 { |
361 { |
794 m_rxWindowSize = tcpHeader.GetWindowSize (); |
791 m_rxWindowSize = tcpHeader.GetWindowSize (); |
795 if (tcpHeader.GetAckNumber () > m_highestRxAck) |
792 if (tcpHeader.GetAckNumber () > m_highestRxAck) |
796 { |
793 { |
797 m_highestRxAck = tcpHeader.GetAckNumber (); |
794 m_highestRxAck = tcpHeader.GetAckNumber (); |
798 // Data freed from the send buffer; notify any blocked sender |
795 // Data freed from the send buffer; notify any blocked sender |
799 if (m_wouldBlock) |
796 if (GetTxAvailable () > 0) |
800 { |
797 { |
801 m_wouldBlock = false; |
|
802 NotifySend (GetTxAvailable ()); |
798 NotifySend (GetTxAvailable ()); |
803 } |
799 } |
804 } |
800 } |
805 SendPendingData (); |
801 SendPendingData (); |
806 break; |
802 break; |
1166 m_retxEvent = Simulator::Schedule (rto, &TcpSocketImpl::ReTxTimeout, this); |
1162 m_retxEvent = Simulator::Schedule (rto, &TcpSocketImpl::ReTxTimeout, this); |
1167 } |
1163 } |
1168 NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack |
1164 NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack |
1169 << " numberAck " << (ack - m_highestRxAck)); // Number bytes ack'ed |
1165 << " numberAck " << (ack - m_highestRxAck)); // Number bytes ack'ed |
1170 m_highestRxAck = ack; // Note the highest recieved Ack |
1166 m_highestRxAck = ack; // Note the highest recieved Ack |
1171 if (m_wouldBlock) |
1167 if (GetTxAvailable () > 0) |
1172 { |
1168 { |
1173 // m_highestRxAck advancing means some data was acked, and the size |
|
1174 // of free space in the buffer has increased |
|
1175 m_wouldBlock = false; |
|
1176 NotifySend (GetTxAvailable ()); |
1169 NotifySend (GetTxAvailable ()); |
1177 } |
1170 } |
1178 if (ack > m_nextTxSequence) |
1171 if (ack > m_nextTxSequence) |
1179 { |
1172 { |
1180 m_nextTxSequence = ack; // If advanced |
1173 m_nextTxSequence = ack; // If advanced |