STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) { if (self->nic == MP_OBJ_NULL) { // select NIC based on IP self->nic = mod_network_find_nic(ip); self->nic_type = (mod_network_nic_type_t*)mp_obj_get_type(self->nic); // call the NIC to open the socket int _errno; if (self->nic_type->socket(self, &_errno) != 0) { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno))); } } }
STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) { if (self->nic == MP_OBJ_NULL) { // select NIC based on IP self->nic = mod_network_find_nic(ip); self->nic_type = (mod_network_nic_type_t*)mp_obj_get_type(self->nic); // call the NIC to open the socket int _errno; if (self->nic_type->socket(self, &_errno) != 0) { mp_raise_OSError(_errno); } } }