aws-samples / aws-iot-securetunneling-localproxy

AWS Iot Secure Tunneling local proxy reference C++ implementation
https://docs.aws.amazon.com/iot/latest/developerguide/what-is-secure-tunneling.html
Apache License 2.0
73 stars 70 forks source link

Fix socket issue #104

Closed RogerZhongAWS closed 1 year ago

RogerZhongAWS commented 1 year ago

Motivation

Proposed fix for the -b custom endpoint CLI option

  1. merged the two different code paths for with -b and without the -b into one with parameterization of the -b input
  2. checking to see if the socket if the tcp socket is already open, and if so, close and reopen

Modifications

Change summary

Please describe what changes are included in this pull request.

Revision diff summary

If there is more than one revision, please explain what has been changed since the last revision.

Testing

Is your change tested? If not, please justify the reason.
Please list your testing steps and test results. Tested to make sure it does not break current functionality. Validated fix for tcp socket closure.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

HarshGandhi-AWS commented 1 year ago

Why are we checking to see if the socket if the tcp socket is already open, and if so, close and reopen?

RogerZhongAWS commented 1 year ago

Why are we checking to see if the socket if the tcp socket is already open, and if so, close and reopen?

we are not able to bind an an already open socket otherwise EDIT: we do not want to bind on the destination side, so I have removed the call to this function in the destination setup logic.