mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
extmod/modnetwork: Remove modnetwork socket u_state member.
To simplify the socket state. The CC3K driver (see drivers/cc3000/inc/socket.h and src/socket.c) has socket() returning an INT16 so there is now enough room to store it directly in the fileno member.
This commit is contained in:
committed by
Damien George
parent
f9d573a4ac
commit
d9749f90ad
@@ -51,16 +51,17 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
|
||||
s->base.type = &socket_type;
|
||||
s->nic = MP_OBJ_NULL;
|
||||
s->nic_type = NULL;
|
||||
s->u_param.domain = MOD_NETWORK_AF_INET;
|
||||
s->u_param.type = MOD_NETWORK_SOCK_STREAM;
|
||||
s->u_param.fileno = -1;
|
||||
s->u_param.bound = false;
|
||||
s->domain = MOD_NETWORK_AF_INET;
|
||||
s->type = MOD_NETWORK_SOCK_STREAM;
|
||||
s->proto = 0;
|
||||
s->bound = false;
|
||||
s->fileno = -1;
|
||||
if (n_args >= 1) {
|
||||
s->u_param.domain = mp_obj_get_int(args[0]);
|
||||
s->domain = mp_obj_get_int(args[0]);
|
||||
if (n_args >= 2) {
|
||||
s->u_param.type = mp_obj_get_int(args[1]);
|
||||
s->type = mp_obj_get_int(args[1]);
|
||||
if (n_args >= 4) {
|
||||
s->u_param.fileno = mp_obj_get_int(args[3]);
|
||||
s->fileno = mp_obj_get_int(args[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user