// method socket.settimeout(value) // timeout=0 means non-blocking // timeout=None means blocking // otherwise, timeout is in seconds STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { mod_network_socket_obj_t *self = self_in; mp_uint_t timeout; if (timeout_in == mp_const_none) { timeout = -1; } else { timeout = 1000 * mp_obj_get_int(timeout_in); } int _errno; if (wlan_socket_settimeout(self, timeout, &_errno) != 0) { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno))); } return mp_const_none; }
// method socket.settimeout(value) // timeout=0 means non-blocking // timeout=None means blocking // otherwise, timeout is in seconds STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { mod_network_socket_obj_t *self = self_in; mp_uint_t timeout; if (timeout_in == mp_const_none) { timeout = -1; } else { timeout = mp_obj_get_int(timeout_in); } int _errno; if (wlan_socket_settimeout(self, timeout, &_errno) != 0) { mp_raise_OSError(-_errno); } return mp_const_none; }