// Two-channel sawtooth wave generator. int AudioDriverRtAudio::callback( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *userData ) { if (status) { if (status & RTAUDIO_INPUT_OVERFLOW) { WARN_PRINT("RtAudio input overflow!"); } if (status & RTAUDIO_OUTPUT_UNDERFLOW) { WARN_PRINT("RtAudio output underflow!"); } } int32_t *buffer = (int32_t *) outputBuffer; AudioDriverRtAudio *self = (AudioDriverRtAudio*)userData; if (self->mutex->try_lock()!=OK) { // what should i do.. for(unsigned int i=0;i<nBufferFrames;i++) buffer[i]=0; return 0; } self->audio_server_process(nBufferFrames,buffer); self->mutex->unlock();; return 0; }
String OS_Unix::get_executable_path() const { #ifdef __linux__ //fix for running from a symlink char buf[256]; memset(buf, 0, 256); ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf)); String b; if (len > 0) { b.parse_utf8(buf, len); } if (b == "") { WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]"); return OS::get_executable_path(); } return b; #elif defined(__OpenBSD__) char resolved_path[MAXPATHLEN]; realpath(OS::get_executable_path().utf8().get_data(), resolved_path); return String(resolved_path); #elif defined(__FreeBSD__) int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; char buf[MAXPATHLEN]; size_t len = sizeof(buf); if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) { WARN_PRINT("Couldn't get executable path from sysctl"); return OS::get_executable_path(); } String b; b.parse_utf8(buf); return b; #elif defined(__APPLE__) char temp_path[1]; uint32_t buff_size = 1; _NSGetExecutablePath(temp_path, &buff_size); char *resolved_path = new char[buff_size + 1]; if (_NSGetExecutablePath(resolved_path, &buff_size) == 1) WARN_PRINT("MAXPATHLEN is too small"); String path(resolved_path); delete[] resolved_path; return path; #else ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly."); return OS::get_executable_path(); #endif }
Error GDMono::reload_scripts_domain() { ERR_FAIL_COND_V(!runtime_initialized, ERR_BUG); if (scripts_domain) { Error err = _unload_scripts_domain(); if (err != OK) { ERR_PRINT("Mono: Failed to unload scripts domain"); return err; } } Error err = _load_scripts_domain(); if (err != OK) { ERR_PRINT("Mono: Failed to load scripts domain"); return err; } #ifdef MONO_GLUE_ENABLED if (!_load_api_assemblies()) { return ERR_CANT_OPEN; } if (!core_api_assembly_out_of_sync && !editor_api_assembly_out_of_sync && GDMonoUtils::mono_cache.godot_api_cache_updated) { // Everything is fine with the api assemblies, load the project assembly _load_project_assembly(); } else { // The assembly was successfully loaded, but the full api could not be cached. // This is most likely an outdated assembly loaded because of an invalid version in the metadata, // so we invalidate the version in the metadata and unload the script domain. if (core_api_assembly_out_of_sync) { ERR_PRINT("The loaded Core API assembly is out of sync"); metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true); } else if (!GDMonoUtils::mono_cache.godot_api_cache_updated) { ERR_PRINT("The loaded Core API assembly is in sync, but the cache update failed"); metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true); } if (editor_api_assembly_out_of_sync) { ERR_PRINT("The loaded Editor API assembly is out of sync"); metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true); } Error err = _unload_scripts_domain(); if (err != OK) { WARN_PRINT("Mono: Failed to unload scripts domain"); } return ERR_CANT_RESOLVE; } if (!_load_project_assembly()) return ERR_CANT_OPEN; #else print_verbose("Mono: Glue disabled, ignoring script assemblies."); #endif return OK; }
World2D::World2D() { canvas = VisualServer::get_singleton()->canvas_create(); space = Physics2DServer::get_singleton()->space_create(); sound_space = SpatialSound2DServer::get_singleton()->space_create(); //set space2D to be more friendly with pixels than meters, by adjusting some constants Physics2DServer::get_singleton()->space_set_active(space,true); Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics_2d/default_gravity",98)); Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics_2d/default_gravity_vector",Vector2(0,1))); // TODO: Remove this deprecation warning and compatibility code for 2.2 or 3.0 if (Globals::get_singleton()->get("physics_2d/default_density") && !Globals::get_singleton()->get("physics_2d/default_linear_damp")) { WARN_PRINT("Deprecated parameter 'physics_2d/default_density'. It was renamed to 'physics_2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics_2d/default_density'."); Globals::get_singleton()->set("physics_2d/default_linear_damp", Globals::get_singleton()->get("physics_2d/default_density")); Globals::get_singleton()->set_persisting("physics_2d/default_linear_damp", true); Globals::get_singleton()->set_persisting("physics_2d/default_density", false); Globals::get_singleton()->save(); } Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics_2d/default_linear_damp",0.1)); Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics_2d/default_angular_damp",1)); Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS,1.0); Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION,1.5); Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION,0.3); Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD,2); Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,0.2); indexer = memnew( SpatialIndexer2D ); }
void EditorFileSystem::_load_type_cache(){ GLOBAL_LOCK_FUNCTION #if 0 //this is not good, removed for now as it interferes with metadata stored in files String project=Globals::get_singleton()->get_resource_path(); FileAccess *f =FileAccess::open(project+"/types.cache",FileAccess::READ); if (!f) { WARN_PRINT("Can't open types.cache."); return; } file_type_cache.clear(); while(!f->eof_reached()) { String path=f->get_line(); if (f->eof_reached()) break; String type=f->get_line(); file_type_cache[path]=type; } memdelete(f); #endif }
String OS_Unix::get_executable_path() const { #ifdef __linux__ //fix for running from a symlink char buf[256]; memset(buf,0,256); readlink("/proc/self/exe", buf, sizeof(buf)); //print_line("Exec path is:"+String(buf)); String b; b.parse_utf8(buf); if (b=="") { WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]"); return OS::get_executable_path(); } return b; #elif defined(__FreeBSD__) char resolved_path[MAXPATHLEN]; realpath(OS::get_executable_path().utf8().get_data(), resolved_path); return String(resolved_path); #else ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly."); return OS::get_executable_path(); #endif }
void ObjectDB::cleanup() { rw_lock->write_lock(); if (instances.size()) { WARN_PRINT("ObjectDB Instances still exist!"); if (OS::get_singleton()->is_stdout_verbose()) { const ObjectID *K = NULL; while ((K = instances.next(K))) { String node_name; if (instances[*K]->is_class("Node")) node_name = " - Node Name: " + String(instances[*K]->call("get_name")); if (instances[*K]->is_class("Resource")) node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path")); print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name); } } } instances.clear(); instance_checks.clear(); rw_lock->write_unlock(); memdelete(rw_lock); }
void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) { ERR_FAIL_INDEX(p_axis, 3); flags[p_axis][p_flag] = p_value; switch (p_flag) { case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: if (flags[p_axis][p_flag]) { sixDOFConstraint->setLimit(p_axis, limits_lower[0][p_axis], limits_upper[0][p_axis]); } else { sixDOFConstraint->setLimit(p_axis, 0, -1); // Free } break; case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: if (flags[p_axis][p_flag]) { sixDOFConstraint->setLimit(p_axis + 3, limits_lower[1][p_axis], limits_upper[1][p_axis]); } else { sixDOFConstraint->setLimit(p_axis + 3, 0, -1); // Free } break; case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag]; break; case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = flags[p_axis][p_flag]; break; default: WARN_PRINT("This flag is not supported by Bullet engine"); return; } }
IP::ResolverID IP::resolve_hostname_queue_item(const String &p_hostname, IP::Type p_type) { resolver->mutex->lock(); ResolverID id = resolver->find_empty_id(); if (id == RESOLVER_INVALID_ID) { WARN_PRINT("Out of resolver queries"); resolver->mutex->unlock(); return id; } String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type); resolver->queue[id].hostname = p_hostname; resolver->queue[id].type = p_type; if (resolver->cache.has(key)) { resolver->queue[id].response = resolver->cache[key]; resolver->queue[id].status = IP::RESOLVER_STATUS_DONE; } else { resolver->queue[id].response = IP_Address(); resolver->queue[id].status = IP::RESOLVER_STATUS_WAITING; if (resolver->thread) resolver->sem->post(); else resolver->resolve_queues(); } resolver->mutex->unlock(); return id; }
void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() { const Vector<CollisionObjectBullet::ShapeWrapper> &shapes_wrappers(owner->get_shapes_wrappers()); const int shapes_count = shapes_wrappers.size(); just_delete_shapes(shapes_count); const CollisionObjectBullet::ShapeWrapper *shape_wrapper; btVector3 owner_scale(owner->get_bt_body_scale()); for (int i = shapes_count - 1; 0 <= i; --i) { shape_wrapper = &shapes_wrappers[i]; if (!shape_wrapper->active) { continue; } shapes.write[i].transform = shape_wrapper->transform; shapes.write[i].transform.getOrigin() *= owner_scale; switch (shape_wrapper->shape->get_type()) { case PhysicsServer::SHAPE_SPHERE: case PhysicsServer::SHAPE_BOX: case PhysicsServer::SHAPE_CAPSULE: case PhysicsServer::SHAPE_CYLINDER: case PhysicsServer::SHAPE_CONVEX_POLYGON: case PhysicsServer::SHAPE_RAY: { shapes.write[i].shape = static_cast<btConvexShape *>(shape_wrapper->shape->create_bt_shape(owner_scale * shape_wrapper->scale, safe_margin)); } break; default: WARN_PRINT("This shape is not supported to be kinematic!"); shapes.write[i].shape = NULL; } } }
void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) { ERR_FAIL_INDEX(p_axis, 3); switch (p_param) { case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: limits_lower[0][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: limits_upper[0][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION: sixDOFConstraint->getTranslationalLimitMotor()->m_restitution = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING: sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis] = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: limits_lower[1][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: limits_upper[1][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value; break; default: WARN_PRINT("This parameter is not supported"); } }
ThreadSafe::ThreadSafe() { mutex = Mutex::create(); if (!mutex) { WARN_PRINT("THREAD_SAFE defined, but no default mutex type"); } }
int PowerJavascript::get_power_percent_left() { if (UpdatePowerInfo()) { return percent_left; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to -1"); return -1; } }
PowerState PowerJavascript::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); return POWERSTATE_UNKNOWN; } }
void NetSocketPosix::set_reuse_address_enabled(bool p_enabled) { ERR_FAIL_COND(!is_open()); int par = p_enabled ? 1 : 0; if (setsockopt(_sock, SOL_SOCKET, SO_REUSEADDR, SOCK_CBUF(&par), sizeof(int)) < 0) { WARN_PRINT("Unable to set socket REUSEADDR option!"); } }
Resource::~Resource() { if (path_cache != "") ResourceCache::resources.erase(path_cache); if (owners.size()) { WARN_PRINT("Resource is still owned"); } }
int power_android::get_power_percent_left() { if (GetPowerInfo_Android()) { return percent_left; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to -1"); return -1; } }
OS::PowerState power_android::get_power_state() { if (GetPowerInfo_Android()) { return power_state; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); return OS::POWERSTATE_UNKNOWN; } }
int PowerBB10::get_power_seconds_left() { if (UpdatePowerInfo()) { return nsecs_left; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to -1"); return -1; } }
static void _png_warn_function(png_structp, png_const_charp text) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint()) { if (String(text).begins_with("iCCP")) return; // silences annoying spam emitted to output every time the user opened assetlib } #endif WARN_PRINT(text); }
static int pic_spur_int_handler (excp_entry_t * excp, excp_vec_t vector, addr_t unused) { WARN_PRINT("Received Spurious interrupt from PIC\n"); IRQ_HANDLER_END(); return 0; }
void RigidBodyBullet::assert_no_constraints() { if (btBody->getNumConstraintRefs()) { WARN_PRINT("A body with a joints is destroyed. Please check the implementation in order to destroy the joint before the body."); } /*for(int i = btBody->getNumConstraintRefs()-1; 0<=i; --i){ btTypedConstraint* btConst = btBody->getConstraintRef(i); JointBullet* joint = static_cast<JointBullet*>( btConst->getUserConstraintPtr() ); space->removeConstraint(joint); }*/ }
void NetSocketPosix::set_broadcasting_enabled(bool p_enabled) { ERR_FAIL_COND(!is_open()); // IPv6 has no broadcast support. ERR_FAIL_COND(_ip_type == IP::TYPE_IPV6); int par = p_enabled ? 1 : 0; if (setsockopt(_sock, SOL_SOCKET, SO_BROADCAST, SOCK_CBUF(&par), sizeof(int)) != 0) { WARN_PRINT("Unable to change broadcast setting"); } }
void NetSocketPosix::set_ipv6_only_enabled(bool p_enabled) { ERR_FAIL_COND(!is_open()); // This option is only avaiable in IPv6 sockets. ERR_FAIL_COND(_ip_type == IP::TYPE_IPV4); int par = p_enabled ? 1 : 0; if (setsockopt(_sock, IPPROTO_IPV6, IPV6_V6ONLY, SOCK_CBUF(&par), sizeof(int)) != 0) { WARN_PRINT("Unable to change IPv4 address mapping over IPv6 option"); } }
/*** * Manage UDP packets */ void NetGameServer::_handle_udp() { DVector<uint8_t> raw; NetGameServerConnection *cd; // Flush packets queue while(udp_queue.size() > 0) { // Only this thread removes from the queue // it is safe to lock here udp_mutex->lock(); QueuedPacket *qp = udp_queue.get(0); udp_queue.remove(0); udp_mutex->unlock(); NetGameServerConnection *cd = _get_client(qp->id); if(cd != NULL) { udp_server->set_send_address(cd->udp_host, cd->udp_port); udp_server->put_packet_buffer(cd->build_pkt(qp)); } memdelete(qp); } // Handle incoming packets if(udp_server->get_available_packet_count() > 0) { udp_server->get_packet_buffer(raw); if(raw.size() < 1) { WARN_PRINT("Invalid UDP Packet!"); return; } cd = _get_client(raw.get(0)); if(cd == NULL) { WARN_PRINT("Invalid UDP Auth!"); return; } cd->handle_udp(raw, udp_server->get_packet_address(), udp_server->get_packet_port()); } }
String OS_Unix::get_executable_path() const { #ifdef __linux__ //fix for running from a symlink char buf[256]; memset(buf,0,256); readlink("/proc/self/exe", buf, sizeof(buf)); String b; b.parse_utf8(buf); if (b=="") { WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]"); return OS::get_executable_path(); } return b; #elif defined(__FreeBSD__) char resolved_path[MAXPATHLEN]; realpath(OS::get_executable_path().utf8().get_data(), resolved_path); return String(resolved_path); #elif defined(__APPLE__) char temp_path[1]; uint32_t buff_size=1; _NSGetExecutablePath(temp_path, &buff_size); char* resolved_path = new char[buff_size + 1]; if (_NSGetExecutablePath(resolved_path, &buff_size) == 1) WARN_PRINT("MAXPATHLEN is too small"); String path(resolved_path); delete[] resolved_path; return path; #elif defined(EMSCRIPTEN) // We return nothing return String(); #else ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly."); return OS::get_executable_path(); #endif }
void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) { int left = length - pos; int write = MIN(p_length, left); if (write < p_length) { WARN_PRINT("Writing less data than requested"); }; copymem(&data[pos], p_src, write); pos += p_length; };
void NetSocketPosix::set_reuse_port_enabled(bool p_enabled) { // Windows does not have this option, as it is always ON when setting REUSEADDR. #ifndef WINDOWS_ENABLED ERR_FAIL_COND(!is_open()); int par = p_enabled ? 1 : 0; if (setsockopt(_sock, SOL_SOCKET, SO_REUSEPORT, SOCK_CBUF(&par), sizeof(int)) < 0) { WARN_PRINT("Unable to set socket REUSEPORT option!"); } #endif }
Error TCPServerPosix::listen(uint16_t p_port, const IP_Address p_bind_address) { ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); int sockfd; #ifdef __OpenBSD__ sock_type = IP::TYPE_IPV4; // OpenBSD does not support dual stacking, fallback to IPv4 only. #else sock_type = IP::TYPE_ANY; #endif // If the bind address is valid use its type as the socket type if (p_bind_address.is_valid()) sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP); ERR_FAIL_COND_V(sockfd == -1, FAILED); #ifndef NO_FCNTL fcntl(sockfd, F_SETFL, O_NONBLOCK); #else int bval = 1; ioctl(sockfd, FIONBIO, &bval); #endif int reuse = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) { WARN_PRINT("REUSEADDR failed!") } struct sockaddr_storage addr; size_t addr_size = _set_listen_sockaddr(&addr, p_port, sock_type, p_bind_address); if (bind(sockfd, (struct sockaddr *)&addr, addr_size) != -1) { if (::listen(sockfd, 1) == -1) { close(sockfd); ERR_FAIL_V(FAILED); }; } else { return ERR_ALREADY_IN_USE; }; if (listen_sockfd != -1) { stop(); }; listen_sockfd = sockfd; return OK; };
Resource::~Resource() { if (path_cache != "") { ResourceCache::lock->write_lock(); ResourceCache::resources.erase(path_cache); ResourceCache::lock->write_unlock(); } if (owners.size()) { WARN_PRINT("Resource is still owned"); } }