kopia lustrzana https://github.com/micropython/micropython
extmod/modusocket: Create new sockets in blocking mode.
To conform with CPython and other MicroPython ports.pull/4213/head
rodzic
6e8f4eaa52
commit
a63875d5ad
|
@ -67,7 +67,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MICROPY_PY_USOCKET_EXTENDED_STATE
|
#if MICROPY_PY_USOCKET_EXTENDED_STATE
|
||||||
s->timeout = 0;
|
s->timeout = -1;
|
||||||
s->state = NULL;
|
s->state = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
|
||||||
|
|
||||||
#if MICROPY_PY_USOCKET_EXTENDED_STATE
|
#if MICROPY_PY_USOCKET_EXTENDED_STATE
|
||||||
// if a timeout was set before binding a NIC, call settimeout to reset it
|
// if a timeout was set before binding a NIC, call settimeout to reset it
|
||||||
if (self->timeout != 0 && self->nic_type->settimeout(self, self->timeout, &_errno) != 0) {
|
if (self->timeout != -1 && self->nic_type->settimeout(self, self->timeout, &_errno) != 0) {
|
||||||
mp_raise_OSError(_errno);
|
mp_raise_OSError(_errno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -158,7 +158,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
|
||||||
socket2->bound = false;
|
socket2->bound = false;
|
||||||
socket2->fileno = -1;
|
socket2->fileno = -1;
|
||||||
#if MICROPY_PY_USOCKET_EXTENDED_STATE
|
#if MICROPY_PY_USOCKET_EXTENDED_STATE
|
||||||
socket2->timeout = 0;
|
socket2->timeout = -1;
|
||||||
socket2->state = NULL;
|
socket2->state = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue