My name:李冠霖
My NJU ID:221502012
I collaborated with: NAN
I would like to thank/reward these classmates for their help: NAN
This lab took me about 8 hours to do. I did attend the lab session.
Describe Wrap32 and TCPReceiver structure and design.
Wrap32: 这个还是蛮简单的,就是要看懂他这里给的是什么意思,首先第一个 wrap
很简单直接加就行了,记得做类型转换就行。第二个 unwrap
最开始我想的是先用 0xffffffff00000000
去 mask 一下这个 checkpoint
把高32位取出来,然后再去凑最近的是哪一个,但是后面发现corner case太多了,不如直接去算最近的是哪一个。首先把减完的 offset
去减去 (1ULL << 32) / 2
保证了一定是在更近的那一半上面,然后直接去看相差了多少个 1ULL << 32
就行了
TCPReceiver: 这个没有什么说法,就去翻译给的message里面的字节就行了,对着手册写就ok了,但是需要注意的是,这里的 RST
位是需要和 ByteStream
里面的 has_error()
保持一致的,但是由于某些问题没法直接set,下面细说。
Implementation Challenges:
- 首先在继承的时候,他这个bytestream里面的
set_error()
方法在 reassambler 层面不可用,因为首先 reassambler 层面没有提供这个方法的调用,而且 writer()
和 reader()
两个方法返回的还是 const
对象,所以没办法直接调用 set_error()
- 其次,这个算
checkpoint
附近最近的值怎么算我一开始没想清楚。
Remaining Bugs:
Experimental results and performance:
最后运行结果的bash输出如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| ❯ cmake --build build --target check2 [0/1] cd /home/eric/minnow/build && /usr/local/bin/ctest --output-on-failure --stop-on-failure --timeout 12 -R '^byte_stream_|^reassembler_|^wrapping|^recv' ByteStream throughput: 21.61 Gbit/s Reassembler throughput: 12.18 Gbit/s [1/1] cd /home/eric/minnow/build && /usr/local/bin/ctest --output-on-failure --stop-on-failure --timeout 12 -R '^byte_stream_|^reassembler_|^wrapping|^recv' Test project /home/eric/minnow/build Start 1: compile with bug-checkers 1/29 Test Start 3: byte_stream_basics 2/29 Test Start 4: byte_stream_capacity 3/29 Test Start 5: byte_stream_one_write 4/29 Test Start 6: byte_stream_two_writes 5/29 Test Start 7: byte_stream_many_writes 6/29 Test Start 8: byte_stream_stress_test 7/29 Test Start 9: reassembler_single 8/29 Test Start 10: reassembler_cap 9/29 Test Start 11: reassembler_seq 10/29 Test Start 12: reassembler_dup 11/29 Test Start 13: reassembler_holes 12/29 Test Start 14: reassembler_overlapping 13/29 Test Start 15: reassembler_win 14/29 Test Start 16: wrapping_integers_cmp 15/29 Test Start 17: wrapping_integers_wrap 16/29 Test Start 18: wrapping_integers_unwrap 17/29 Test Start 19: wrapping_integers_roundtrip 18/29 Test Start 20: wrapping_integers_extra 19/29 Test Start 21: recv_connect 20/29 Test Start 22: recv_transmit 21/29 Test Start 23: recv_window 22/29 Test Start 24: recv_reorder 23/29 Test Start 25: recv_reorder_more 24/29 Test Start 26: recv_close 25/29 Test Start 27: recv_special 26/29 Test Start 37: compile with optimization 27/29 Test Start 38: byte_stream_speed_test 28/29 Test Start 39: reassembler_speed_test 29/29 Test
100% tests passed, 0 tests failed out of 29
Total Test time (real) = 13.43 sec
|
图片版本如下:

比较神奇的是这里的reassambler竟然跑的比上一次快。
另外本人写了一个基于 gitlab-ci
的自动化测试工具放在 .gitlab-ci.yml
里面了,只要自己注册个runner就可以跑
Optional: I had unexpected difficulty with: [describe]
Optional: I think you could make this lab better by: [describe]
Optional: I was surprised by: [describe]
Optional: I’m not sure about: [describe]
Optional: I made an extra test I think will be helpful in catching bugs: [describe where to find]