Skip to content

Commit 3b30f0c

Browse files
committed
espressif: allow socket(AF_INET6)
1 parent d612d18 commit 3b30f0c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

locale/circuitpython.pot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ msgid "Interrupted by output function"
11771177
msgstr ""
11781178

11791179
#: ports/espressif/common-hal/espulp/ULP.c
1180+
#: ports/espressif/common-hal/microcontroller/Processor.c
11801181
#: ports/mimxrt10xx/common-hal/audiobusio/__init__.c
11811182
#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c
11821183
#: ports/raspberrypi/bindings/picodvi/Framebuffer.c
@@ -1557,7 +1558,6 @@ msgstr ""
15571558
msgid "Only IPv4 addresses supported"
15581559
msgstr ""
15591560

1560-
#: ports/espressif/common-hal/socketpool/Socket.c
15611561
#: ports/raspberrypi/common-hal/socketpool/Socket.c
15621562
msgid "Only IPv4 sockets supported"
15631563
msgstr ""
@@ -2219,6 +2219,10 @@ msgstr ""
22192219
msgid "Unsupported hash algorithm"
22202220
msgstr ""
22212221

2222+
#: ports/espressif/common-hal/socketpool/Socket.c
2223+
msgid "Unsupported socket type"
2224+
msgstr ""
2225+
22222226
#: ports/espressif/common-hal/_bleio/Adapter.c
22232227
#: ports/espressif/common-hal/dualbank/__init__.c
22242228
msgid "Update failed"

ports/espressif/common-hal/socketpool/Socket.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,14 @@ bool socketpool_socket(socketpool_socketpool_obj_t *self,
230230

231231
socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self,
232232
socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type, int proto) {
233-
if (family != SOCKETPOOL_AF_INET) {
234-
mp_raise_NotImplementedError(MP_ERROR_TEXT("Only IPv4 sockets supported"));
233+
switch (family) {
234+
#if CIRCUITPY_SOCKETPOOL_IPV6
235+
case SOCKETPOOL_AF_INET6:
236+
#endif
237+
case SOCKETPOOL_AF_INET:
238+
break;
239+
default:
240+
mp_raise_NotImplementedError(MP_ERROR_TEXT("Unsupported socket type"));
235241
}
236242

237243
socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t);

0 commit comments

Comments
 (0)