facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.05k stars 539 forks source link

Allow access to tcpinfo on macOS, using tcp_connection_info #125

Closed DailyMats closed 6 years ago

DailyMats commented 6 years ago

On macOS, the tcp_connection_info struct provides almost the same information as the tcp_info struct on Linux and FreeBSD. With the help of a couple of #ifdefs, this pull request makes the tcpinfo field in wangle::TransportInfo available on macOS as well.

To further simplify getting the TCP state through tcpinfo.tcpi_state (which is my main motivation for doing this), I've added #ifdefs for the macOS values TCPS_* to the Linux/FreeBSD TCP_* macros.

facebook-github-bot commented 6 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

DailyMats commented 6 years ago

I have signed the CLA.

facebook-github-bot commented 6 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

DailyMats commented 6 years ago

@yfeldblum I've reduced the amount of defines that are sprinkled around, and changed to modern initialization of the tcpinfo member (which is the only change outside of the __APPLE__ ifdefs).