snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

TCP review - adds comments, tests, and reorganizes some methods

Open howardwu opened this issue 3 years ago • 1 comments

Motivation

This PR adds and updates comments and traces in the Tcp stack, and reorganizes methods for easier readability.

The following are the only logic changes to the Tcp stack.

  • Abstracts the listening task logic into 2 new methods: enable_listener and handle_connection
  • Adds Tcp::connecting_addrs to retrieve the pending IP addresses
  • (https://github.com/AleoHQ/snarkOS/pull/2143/commits/316c75654a2753857aeb747bb065ad150c497d46) Switches !can_add_connection error from PermissionDenied to ConnectionRefused

Test Plan

This PR adds tests on the following Tcp methods:

  • new
  • connect
  • disconnect
  • can_add_connection
  • handle_connection
  • adapt_stream

Related PRs

None

howardwu avatar Dec 05 '22 00:12 howardwu

@ljedrz I was careful to ensure no logic changes took place besides the 3 bullet points enumerated in this PR description.

howardwu avatar Dec 05 '22 02:12 howardwu