Skip to content

Commit 4c7bc9e

Browse files
committed
Pint: Send socket config to binding.
Forward domain, type and proto to the socket binding.
1 parent 0854c8f commit 4c7bc9e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

micropython/modules/pint/pint.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ MP_DEFINE_CONST_OBJ_TYPE(
3939
static const mp_map_elem_t pint_globals_table[] = {
4040
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pint) },
4141
{ MP_OBJ_NEW_QSTR(MP_QSTR_PINT), (mp_obj_t)&mod_network_nic_type_pint },
42+
43+
{ MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(MOD_NETWORK_AF_INET) },
44+
{ MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_ROM_INT(MOD_NETWORK_AF_INET6) },
45+
46+
{ MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(MOD_NETWORK_SOCK_STREAM) },
47+
{ MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(MOD_NETWORK_SOCK_DGRAM) },
48+
{ MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(MOD_NETWORK_SOCK_RAW) },
4249
};
4350

4451
static MP_DEFINE_CONST_DICT(mp_module_pint_globals, pint_globals_table);

micropython/modules/pint/pint.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ int network_pint_socket_socket(mod_network_socket_obj_t *socket, int *_errno) {
139139

140140
_pint_obj_t *nic = (_pint_obj_t *)MP_OBJ_TO_PTR(socket->nic);
141141

142-
mp_obj_t result = call_method(nic->socket_socket);
142+
mp_obj_t _domain = mp_obj_new_int(socket->domain);
143+
mp_obj_t _type = mp_obj_new_int(socket->type);
144+
mp_obj_t _proto = mp_obj_new_int(socket->proto);
145+
146+
mp_obj_t result = call_method(nic->socket_socket, 3, _domain, _type, _proto);
143147
if (result != mp_const_none) {
144148
socket->_private = (void *)result;
145149
*_errno = 0;

0 commit comments

Comments
 (0)