Skip to content

Commit 287db84

Browse files
committed
refactor: Update data packet info text and handling logic
1 parent 1396e71 commit 287db84

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/utils/getInfoText.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const infoTextMap: Record<number, string | null> = {
33
1: 'Step 2: Server responds with SYN-ACK packet',
44
2: 'Step 3: Client sends ACK packet, completing the three-way handshake',
55
3: 'Step 4: Connection established, data transfer begins',
6-
4: null,
7-
5: null,
8-
6: null,
9-
7: null,
10-
8: null,
6+
4: null, // Data packet 1
7+
5: null, // Data packet 2
8+
6: null, // Data packet 3
9+
7: null, // Data packet 4
10+
8: 'Step 9: Final data packet sent',
1111
9: 'Step 10: Client initiates connection termination with FIN packet',
1212
10: 'Step 11: Server acknowledges with ACK',
1313
11: 'Step 12: Server sends its own FIN packet',
@@ -18,7 +18,9 @@ const infoTextMap: Record<number, string | null> = {
1818
function getInfoText(step: number) {
1919
const infoText = infoTextMap[step]
2020

21-
return infoText ? infoText : `Data packet ${step - 2} being transferred`
21+
return infoText
22+
? infoText
23+
: `Step ${step + 1}: Data packet ${step - 3} being transferred`
2224
}
2325

2426
export default getInfoText

0 commit comments

Comments
 (0)