Skip to content

Commit

Permalink
extmod/modusocket: Initialise accepted socket state.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader authored and dpgeorge committed Jan 12, 2022
1 parent 67420de commit 842da93
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions extmod/modusocket.c
Expand Up @@ -151,6 +151,17 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
socket2->nic = MP_OBJ_NULL;
socket2->nic_type = NULL;

// set the same address family, socket type and protocol as parent
socket2->domain = self->domain;
socket2->type = self->type;
socket2->proto = self->proto;
socket2->bound = false;
socket2->fileno = -1;
#if MICROPY_PY_USOCKET_EXTENDED_STATE
socket2->timeout = 0;
socket2->state = NULL;
#endif

// accept incoming connection
uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE];
mp_uint_t port;
Expand Down

0 comments on commit 842da93

Please sign in to comment.