Lab 1 Analysis

advertisement
Lab 1 Analysis
Grades of every test case
Grades of each test case
11
10
9
8
7
6
5
4
3
2
1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Tricky parts
• Call conn_bufspace before conn_output
• Output logic is used in 2 places
• After you receive a packet
• After the framework calls rel_output
• That’s why I abstract output logic into a separate function
• Don’t store the packet pointer directly
• Examine the length of the packet (OpenSSL)
• The EOF packet may get lost & Packets before EOF
packet may get lost
• Use a tag to record whether you have sent EOF packet
• Treat EOF packet as a normal data packet
Tricky parts (Cont.)
• Teardown requirements
• All packets acked (1)
• All packets received (2) and output (3)
• Send EOF (4)& receive EOF (5)
• Multiple Teardown Scenarios
•
•
•
•
All but (3) meet
All but (1) meet
……
Only call rel_destroy in rel_timer
Some programming experience
• Use object-oriented programming whenever
possible
• Any function should be around 30 lines
• At most 3 levels of nested statements
• If
• For
• if
One Practical Design
• Rel_t
• Sender_t
• An array of packets to be sent
• Send window [left, right]
• Receiver_t
• Packets received but not output
• Lowest seqno of receive window
Rel_read
Send window full
set read_eof
Sender_register_packet
Sender_register_packet
init packet content
Add Packet to the
array
sender_send_all
Sender_send_all
Iterate_all_packet
Sent_timestamp + 5 < current_timestamp?
sender_send_one_packet
Iterate Next packet?
Rel_recvpkt
examine cksum
examine packet
len
sender_ack_pkt
receiver_register_
packet
Receiver_reg_packet
copy packet data
put packet into
the array
receiver_output_
all
Receiver_output_all
Iterate each packet
and output
send ack packet
0
1
2
3
0
1
2
3
Rel_timer
increase global
timestamp
examine teardown
requirements
sender_send_all
• Thank you
Download