MCPcopy Create free account
hub / github.com/defold/defold / Shutdown

Function Shutdown

engine/dlib/src/dlib/connection_pool.cpp:630–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628 }
629
630 uint32_t Shutdown(HPool pool, dmSocket::ShutdownType how)
631 {
632 // Shut down all in use and prevent new ones. Return total count of
633 // in-use connections.
634 DM_MUTEX_SCOPED_LOCK(pool->m_Mutex);
635 uint32_t count = 0;
636 uint32_t n = pool->m_Connections.Size();
637 for (uint32_t i=0; i != n; i++) {
638 Connection* c = &pool->m_Connections[i];
639 if (c->m_State == STATE_INUSE) {
640 count++;
641 if (!c->m_WasShutdown) {
642 // Due to threaded behavior, the connection may be in use,
643 // but the socket's haven't been assigned yet
644 if(c->m_Socket != dmSocket::INVALID_SOCKET_HANDLE)
645 {
646 dmSocket::Shutdown(c->m_Socket, how);
647 c->m_Socket = dmSocket::INVALID_SOCKET_HANDLE;
648 }
649 c->m_WasShutdown = 1;
650 }
651 }
652 }
653 pool->m_AllowNewConnections = 0;
654 return count;
655 }
656
657 void Reopen(HPool pool)
658 {

Callers 1

DoCloseFunction · 0.70

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected