-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opt-in purerlang implementation of gen_tcp and gen_udp using socket API #941
Conversation
@@ -29,6 +29,10 @@ extern "C" { | |||
|
|||
#define TAG "otp_socket" | |||
|
|||
#define AVM_LOGD(tag, format, ...) \ | |||
; | |||
// fprintf(stderr, "D %s: " format " (%s:%i)\n", tag, ##__VA_ARGS__, __FILE__, __LINE__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of. Since there is no way to configure log levels, I figured I'd leave these in place so they could be uncommented. But since they are offensive, I have removed them.
@@ -26,6 +26,10 @@ | |||
|
|||
#define TAG "otp_socket" | |||
|
|||
#define AVM_LOGD(tag, format, ...) \ | |||
; | |||
// fprintf(stderr, "D %s: " format " (%s:%i)\n", tag, ##__VA_ARGS__, __FILE__, __LINE__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
tests/libs/estdlib/test_gen_tcp.erl
Outdated
end, | ||
% timer:sleep(50), | ||
|
||
% erlang:display({closing, client, socket}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove debug code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, as well as other locations in this module
Just one question for my better understanding: did we place an additional gen_server in the middle between the caller and the port driver? |
No, just a module/function call, in the case of the inet driver. In the case of the OTP socket driver, yes, there is a gen_server that manages the “state” of the gen_(tcp|udp) Unfortunately, it’s not really clear in git, but the old gen_tcp.erl is essentially the same as the (new) gen_tcp_inet.erl, and similarly for the UDP module. |
Signed-off-by: Fred Dushin <fred@dushin.net>
13c6df1
to
3be5b78
Compare
This PR adds the ability to use the
gen_tcp
andgen_udp
interfaces using the OTP socket interface as a "back-end", eliminating the need for the native C drivers on generic_unix and ESP32.Using the feature also allows use of the
gen_tcp
andgen_udp
interfaces on the rp2040 platform.This feature is still considered "experimental" and therefore is not currently documented. However, the configuration APIs follow the OTP
inet_backend
configuration option introduced in OTP-23.This PR addresses issue #893
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later