tcp: Whitespace cleanup, move a define to header and fix a typo.
This commit is contained in:
@@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// - RFC 793 - Transmission Control Protocol
|
// - RFC 793 - Transmission Control Protocol
|
||||||
// - RFC 813 - Window and Acknowledgement Strategy in TCP
|
// - RFC 813 - Window and Acknowledgement Strategy in TCP
|
||||||
// - RFC 1337 - TIME_WAIT Assassination Hazards in TCP
|
// - RFC 1337 - TIME_WAIT Assassination Hazards in TCP
|
||||||
//
|
//
|
||||||
// Things this implementation currently doesn't implement:
|
// Things this implementation currently doesn't implement:
|
||||||
@@ -304,8 +304,6 @@ protected:
|
|||||||
# define T(x)
|
# define T(x)
|
||||||
#endif // TCP_TRACING
|
#endif // TCP_TRACING
|
||||||
|
|
||||||
// Initial estimate for packet round trip time (RTT)
|
|
||||||
#define TCP_INITIAL_RTT 2000000
|
|
||||||
|
|
||||||
// constants for the fFlags field
|
// constants for the fFlags field
|
||||||
enum {
|
enum {
|
||||||
@@ -1280,8 +1278,7 @@ TCPEndpoint::_DuplicateAcknowledge(tcp_segment_header &segment)
|
|||||||
|
|
||||||
if (fDuplicateAcknowledgeCount == 3) {
|
if (fDuplicateAcknowledgeCount == 3) {
|
||||||
_ResetSlowStart();
|
_ResetSlowStart();
|
||||||
fCongestionWindow = fSlowStartThreshold + 3
|
fCongestionWindow = fSlowStartThreshold + 3 * fSendMaxSegmentSize;
|
||||||
* fSendMaxSegmentSize;
|
|
||||||
fSendNext = segment.acknowledge;
|
fSendNext = segment.acknowledge;
|
||||||
} else if (fDuplicateAcknowledgeCount > 3)
|
} else if (fDuplicateAcknowledgeCount > 3)
|
||||||
fCongestionWindow += fSendMaxSegmentSize;
|
fCongestionWindow += fSendMaxSegmentSize;
|
||||||
@@ -2253,7 +2250,7 @@ TCPEndpoint::_Acknowledged(tcp_segment_header& segment)
|
|||||||
fCongestionWindow += increment;
|
fCongestionWindow += increment;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is data left to be send, send it now
|
// if there is data left to be sent, send it now
|
||||||
if (fSendQueue.Used() > 0)
|
if (fSendQueue.Used() > 0)
|
||||||
_SendQueued();
|
_SendQueued();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ private:
|
|||||||
tcp_sequence fInitialSendSequence;
|
tcp_sequence fInitialSendSequence;
|
||||||
uint32 fDuplicateAcknowledgeCount;
|
uint32 fDuplicateAcknowledgeCount;
|
||||||
|
|
||||||
net_route *fRoute;
|
net_route *fRoute;
|
||||||
// TODO: don't use a net_route, but a net_route_info!!!
|
// TODO: don't use a net_route, but a net_route_info!!!
|
||||||
// (the latter will automatically adapt to routing changes)
|
// (the latter will automatically adapt to routing changes)
|
||||||
|
|
||||||
|
|||||||
@@ -43,30 +43,30 @@ enum tcp_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct tcp_header {
|
struct tcp_header {
|
||||||
uint16 source_port;
|
uint16 source_port;
|
||||||
uint16 destination_port;
|
uint16 destination_port;
|
||||||
uint32 sequence;
|
uint32 sequence;
|
||||||
uint32 acknowledge;
|
uint32 acknowledge;
|
||||||
struct {
|
struct {
|
||||||
#if B_HOST_IS_LENDIAN == 1
|
#if B_HOST_IS_LENDIAN == 1
|
||||||
uint8 reserved : 4;
|
uint8 reserved : 4;
|
||||||
uint8 header_length : 4;
|
uint8 header_length : 4;
|
||||||
#else
|
#else
|
||||||
uint8 header_length : 4;
|
uint8 header_length : 4;
|
||||||
uint8 reserved : 4;
|
uint8 reserved : 4;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
uint8 flags;
|
uint8 flags;
|
||||||
uint16 advertised_window;
|
uint16 advertised_window;
|
||||||
uint16 checksum;
|
uint16 checksum;
|
||||||
uint16 urgent_offset;
|
uint16 urgent_offset;
|
||||||
|
|
||||||
uint32 HeaderLength() const { return (uint32)header_length << 2; }
|
uint32 HeaderLength() const { return (uint32)header_length << 2; }
|
||||||
uint32 Sequence() const { return ntohl(sequence); }
|
uint32 Sequence() const { return ntohl(sequence); }
|
||||||
uint32 Acknowledge() const { return ntohl(acknowledge); }
|
uint32 Acknowledge() const { return ntohl(acknowledge); }
|
||||||
uint16 AdvertisedWindow() const { return ntohs(advertised_window); }
|
uint16 AdvertisedWindow() const { return ntohs(advertised_window); }
|
||||||
uint16 Checksum() const { return ntohs(checksum); }
|
uint16 Checksum() const { return ntohs(checksum); }
|
||||||
uint16 UrgentOffset() const { return ntohs(urgent_offset); }
|
uint16 UrgentOffset() const { return ntohs(urgent_offset); }
|
||||||
} _PACKED;
|
} _PACKED;
|
||||||
|
|
||||||
class tcp_sequence {
|
class tcp_sequence {
|
||||||
@@ -187,6 +187,8 @@ operator==(tcp_sequence a, tcp_sequence b)
|
|||||||
#define TCP_MAX_SEGMENT_LIFETIME 60000000 // 60 secs
|
#define TCP_MAX_SEGMENT_LIFETIME 60000000 // 60 secs
|
||||||
#define TCP_PERSIST_TIMEOUT 1000000 // 1 sec
|
#define TCP_PERSIST_TIMEOUT 1000000 // 1 sec
|
||||||
|
|
||||||
|
// Initial estimate for packet round trip time (RTT)
|
||||||
|
#define TCP_INITIAL_RTT 2000000 // 2 secs
|
||||||
// Minimum retransmit timeout (consider delayed ack)
|
// Minimum retransmit timeout (consider delayed ack)
|
||||||
#define TCP_MIN_RETRANSMIT_TIMEOUT 200000 // 200 msecs
|
#define TCP_MIN_RETRANSMIT_TIMEOUT 200000 // 200 msecs
|
||||||
// Maximum retransmit timeout (per RFC6298)
|
// Maximum retransmit timeout (per RFC6298)
|
||||||
|
|||||||
Reference in New Issue
Block a user