[mapguide-commits] r4681 - in sandbox/adsk/2.2gp:
Common/Foundation/System Common/MapGuideCommon
Common/MapGuideCommon/Services Server/src/Common/Base
Web/src/WebSupport
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 22 13:54:25 EDT 2010
Author: brucedechant
Date: 2010-03-22 13:54:24 -0400 (Mon, 22 Mar 2010)
New Revision: 4681
Added:
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.h
Modified:
sandbox/adsk/2.2gp/Common/Foundation/System/AceStreamHelper.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Makefile.am
sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommon.vcproj
sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommonBuild.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnection.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionImp.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.h
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.h
sandbox/adsk/2.2gp/Server/src/Common/Base/ClientHandler.cpp
sandbox/adsk/2.2gp/Web/src/WebSupport/InitializeWebTier.cpp
Log:
Fix for trac ticket 900 - Connections in CLOSE_WAIT status never close and are not reused
http://trac.osgeo.org/mapguide/ticket/900
Notes:
- Added background thread on the web tier side to check when a socket connection is closed on the server side and then close it properly
- Increased stale time to 2 minutes from 1 minute to help prevent connections from being cycled too early
- Added some additional error handling
Modified: sandbox/adsk/2.2gp/Common/Foundation/System/AceStreamHelper.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/Foundation/System/AceStreamHelper.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/Foundation/System/AceStreamHelper.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -213,6 +213,11 @@
stat = ( bConnected ) ? MgStreamHelper::mssNotDone : MgStreamHelper::mssError;
}
+ else if (res == 0)
+ {
+ // No longer connected
+ stat = MgStreamHelper::mssError;
+ }
else
{
m_readBufEnd += res;
@@ -238,6 +243,11 @@
stat = ( bConnected ) ? MgStreamHelper::mssNotDone : MgStreamHelper::mssError;
}
+ else if (res == 0)
+ {
+ // No longer connected
+ stat = MgStreamHelper::mssError;
+ }
else
{
m_readBufEnd += res;
@@ -422,7 +432,7 @@
else
{
res = stream.send(buffer, size, MG_MSG_NOSIGNAL);
- };
+ }
// check for failure
if ( res >= 0 )
@@ -438,12 +448,12 @@
else
{
stat = blocking ? MgStreamHelper::mssError : MgStreamHelper::mssNotDone;
- };
- };
- };
+ }
+ }
+ }
return stat;
-};
+}
//////////////////////////////////////////////////////////////////
///<summary>
@@ -548,7 +558,7 @@
bool MgAceStreamHelper::IsConnected()
{
- bool bConnected = false;
+ bool bConnected = true;
ACE_SOCK_Stream stream;
stream.set_handle( m_handle );
UINT8 dummy;
@@ -557,6 +567,7 @@
if ( res < 0 )
{
+ // Error or timeout occured
#ifdef _WIN32
int error = ::WSAGetLastError(); // errno doesn't work correctly on Windows
bConnected = ( error == WSAEWOULDBLOCK || error == 0 );
@@ -564,6 +575,11 @@
bConnected = ( errno == EWOULDBLOCK || errno == 0 || errno == ETIME );
#endif
}
+ else if (res == 0)
+ {
+ // No longer connected
+ bConnected = false;
+ }
return bConnected;
}
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Makefile.am
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Makefile.am 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Makefile.am 2010-03-22 17:54:24 UTC (rev 4681)
@@ -108,6 +108,7 @@
Services/ServerAdmin.cpp \
Services/ServerAdminDefs.cpp \
Services/ServerConnection.cpp \
+ Services/ServerConnectionEventHandler.cpp \
Services/ServerConnectionImp.cpp \
Services/ServerConnectionPool.cpp \
Services/ServerConnectionStack.cpp \
@@ -230,6 +231,7 @@
Services/ServerAdmin.h \
Services/ServerAdminDefs.h \
Services/ServerConnection.h \
+ Services/ServerConnectionEventHandler.h \
Services/ServerConnectionImp.h \
Services/ServerConnectionPool.h \
Services/ServerConnectionStack.h \
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommon.vcproj
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommon.vcproj 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommon.vcproj 2010-03-22 17:54:24 UTC (rev 4681)
@@ -4357,6 +4357,46 @@
>
</File>
<File
+ RelativePath=".\Services\ServerConnectionEventHandler.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Services\ServerConnectionEventHandler.h"
+ >
+ </File>
+ <File
RelativePath=".\Services\ServerConnectionImp.cpp"
>
<FileConfiguration
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommonBuild.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommonBuild.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/MapGuideCommonBuild.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -118,6 +118,7 @@
#include "Services/ServerConnectionImp.cpp"
#include "Services/ServerConnectionPool.cpp"
#include "Services/ServerConnectionStack.cpp"
+#include "Services/ServerConnectionEventHandler.cpp"
#include "Services/ServerInformation.cpp"
#include "Services/Site.cpp"
#include "Services/SiteManager.cpp"
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnection.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnection.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnection.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -28,8 +28,7 @@
#include <dlfcn.h>
#endif
-static Ptr<MgServerConnectionPool> g_connectionPool = new MgServerConnectionPool();
-const time_t MgServerConnection::sm_kStaleTime = 60; // in seconds
+const time_t MgServerConnection::sm_kStaleTime = 120; // in seconds
ACE_Recursive_Thread_Mutex MgServerConnection::sm_mutex;
//////////////////////////////////////////////////////////////////
@@ -292,6 +291,9 @@
CHECKNULL((MgUserInformation*)userInformation, L"MgServerConnection.Acquire");
CHECKNULL((MgConnectionProperties*)connProp, L"MgServerConnection.Acquire");
+ MgServerConnectionPool* connectionPool = MgServerConnectionPool::GetInstance();
+ CHECKNULL(connectionPool, L"MgServerConnection.Acquire");
+
Ptr<MgServerConnection> msc;
MgServerConnectionStack* stack = NULL;
@@ -300,9 +302,9 @@
ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, NULL));
wstring hash = connProp->Hash();
- MgServerConnectionPool::ConnectionPool::iterator iter = g_connectionPool->pool.find(hash);
+ MgServerConnectionPool::ConnectionPool::iterator iter = connectionPool->pool.find(hash);
- if (iter != g_connectionPool->pool.end())
+ if (iter != connectionPool->pool.end())
{
stack = iter->second;
}
@@ -310,7 +312,7 @@
if (stack == NULL)
{
stack = new MgServerConnectionStack(connProp->GetPort());
- (g_connectionPool->pool)[hash] = stack;
+ (connectionPool->pool)[hash] = stack;
}
}
@@ -364,6 +366,7 @@
ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex));
wstring hash = connProp->Hash();
- g_connectionPool->pool.erase(hash);
+ MgServerConnectionPool* connectionPool = MgServerConnectionPool::GetInstance();
+ connectionPool->pool.erase(hash);
}
}
Added: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.cpp (rev 0)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -0,0 +1,49 @@
+//
+// Copyright (C) 2004-2010 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "ServerConnectionImp.h"
+#include "ServerConnectionStack.h"
+#include "ServerConnectionPool.h"
+#include "ServerConnection.h"
+#include "ServerConnectionEventHandler.h"
+
+MgServerConnectionEventHandler::MgServerConnectionEventHandler()
+{
+}
+
+MgServerConnectionEventHandler::~MgServerConnectionEventHandler()
+{
+}
+
+int MgServerConnectionEventHandler::handle_timeout(const ACE_Time_Value& currentTime, const void* arg)
+{
+ MG_TRY()
+
+ ACE_UNUSED_ARG(currentTime);
+ ACE_UNUSED_ARG(arg);
+
+ ACE_Time_Value now = ACE_High_Res_Timer::gettimeofday();
+ MgServerConnectionPool* pool = MgServerConnectionPool::GetInstance();
+ if (NULL != pool)
+ {
+ pool->CloseStaleConnections(&now);
+ }
+
+ MG_CATCH_AND_RELEASE()
+ return 0;
+}
Property changes on: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.h
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.h (rev 0)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.h 2010-03-22 17:54:24 UTC (rev 4681)
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2004-2010 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_SERVER_CONNECTION_EVENT_HANDLER_H
+#define MG_SERVER_CONNECTION_EVENT_HANDLER_H
+
+#include "Foundation.h"
+
+
+class MgServerConnectionEventHandler : public ACE_Event_Handler
+{
+public:
+
+ MgServerConnectionEventHandler();
+ virtual ~MgServerConnectionEventHandler();
+
+ // ACE_Event_Handler method
+ int handle_timeout(const ACE_Time_Value& currentTime, const void* arg);
+
+private:
+
+ // Unimplemented Constructors/Methods
+
+ // MgServerConnectionEventHandler();
+ // MgServerConnectionEventHandler(const MgServerConnectionEventHandler&);
+ // MgServerConnectionEventHandler& operator=(const MgServerConnectionEventHandler&);
+};
+
+#endif
\ No newline at end of file
Property changes on: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionEventHandler.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionImp.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionImp.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionImp.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -133,17 +133,6 @@
{
if (mServer != NULL)
{
- // Send a control packet to the server to dump the connection early
- Ptr<MgAceStreamHelper> streamHelper = new MgAceStreamHelper(mServer->get_handle());
- MgStream stream(streamHelper);
-
- MgControlPacket packet;
- packet.m_PacketHeader = MgPacketParser::mphControl;
- packet.m_PacketVersion = 1;
- packet.m_ControlID = MgPacketParser::mciClose;
-
- stream.WriteControlPacket(packet);
-
// close the writer and attempt to gracefully leave
mServer->close_writer();
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -18,16 +18,42 @@
#include "MapGuideCommon.h"
#include "ServerConnectionPool.h"
#include "ServerConnectionStack.h"
+#include "ServerConnectionEventHandler.h"
+MgServerConnectionPool* MgServerConnectionPool::sm_pool = NULL;
+
/// <summary>
/// Constructor for connection stack
/// </summary>
MgServerConnectionPool::MgServerConnectionPool()
{
+ // Start up the event timer.
+ m_timer.reactor(ACE_Reactor::instance());
+ m_timer.activate();
+
+ // Create the event handler and register to fire every 20 seconds
+ m_eventHandler = new MgServerConnectionEventHandler();
+ ACE_Time_Value interval = ACE_Time_Value(20);
+ ACE_Time_Value startTime = ACE_OS::gettimeofday() + interval;
+ m_id = m_timer.schedule(m_eventHandler, 0, startTime, interval);
}
MgServerConnectionPool::~MgServerConnectionPool()
{
+ m_timer.cancel(m_id);
+ m_timer.deactivate();
+ m_timer.close();
+
+ // Remove the event handler.
+ if (NULL != m_eventHandler)
+ {
+ ACE_Reactor::instance()->remove_handler(m_eventHandler,
+ ACE_Event_Handler::TIMER_MASK | ACE_Event_Handler::DONT_CALL);
+ }
+
+ delete m_eventHandler;
+ m_eventHandler = NULL;
+
ConnectionPool::iterator iter = pool.begin();
while (iter != pool.end())
{
@@ -46,3 +72,54 @@
{
delete this;
}
+
+MgServerConnectionPool* MgServerConnectionPool::GetInstance()
+{
+ MG_TRY()
+
+ if (MgServerConnectionPool::sm_pool == NULL)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0));
+ if (MgServerConnectionPool::sm_pool == NULL)
+ {
+ MgServerConnectionPool::sm_pool = new MgServerConnectionPool();
+ }
+ }
+
+ MG_CATCH_AND_THROW(L"MgServerConnectionPool.GetInstance")
+
+ // To avoid overheads and maintain thread safety,
+ // do not assign this returned static singleton to a Ptr object.
+ return MgServerConnectionPool::sm_pool;
+}
+
+void MgServerConnectionPool::CloseStaleConnections(ACE_Time_Value* timeValue)
+{
+ ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance ()));
+ MG_TRY()
+ MgServerConnectionPool::ConnectionPool::iterator iter;
+ for (iter = MgServerConnectionPool::sm_pool->pool.begin();
+ iter != MgServerConnectionPool::sm_pool->pool.end();
+ iter++)
+ {
+ MgServerConnectionStack* stack = iter->second;
+ if (NULL != stack)
+ {
+ stack->CloseStaleConnections(timeValue);
+ }
+ }
+ MG_CATCH_AND_RELEASE()
+}
+
+void MgServerConnectionPool::CloseConnections()
+{
+ ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance ()));
+ MG_TRY()
+ if (MgServerConnectionPool::sm_pool != NULL)
+ {
+ delete MgServerConnectionPool::sm_pool;
+ MgServerConnectionPool::sm_pool = NULL;
+ }
+ MG_CATCH_AND_RELEASE()
+}
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.h
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.h 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionPool.h 2010-03-22 17:54:24 UTC (rev 4681)
@@ -24,10 +24,15 @@
class MG_MAPGUIDE_API MgServerConnection;
class MG_MAPGUIDE_API MgConnectionProperties;
+class MgServerConnectionEventHandler;
#endif
#include <map>
+#include "MapGuideCommon.h"
+#include "ace/Reactor.h"
+#include "ace/Timer_Queue_Adapters.h"
+#include "ace/Timer_Heap.h"
class MgServerConnectionPool;
template class MG_MAPGUIDE_API Ptr<MgServerConnectionPool>;
@@ -54,6 +59,21 @@
///
virtual ~MgServerConnectionPool();
+ /// \brief
+ /// Return global instance
+ ///
+ static MgServerConnectionPool* GetInstance();
+
+ /// \brief
+ /// Close expired connections
+ ///
+ static void CloseStaleConnections(ACE_Time_Value* timeValue);
+
+ /// \brief
+ /// Close global instance and release all connections
+ ///
+ static void CloseConnections();
+
typedef std::map<wstring, MgServerConnectionStack*> ConnectionPool;
ConnectionPool pool;
@@ -61,6 +81,13 @@
protected:
void Dispose();
+
+private:
+
+ ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Heap> m_timer;
+ long m_id;
+ MgServerConnectionEventHandler* m_eventHandler;
+ static MgServerConnectionPool* sm_pool;
};
/// \endcond
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -145,20 +145,6 @@
ACE_Time_Value now = ACE_High_Res_Timer::gettimeofday();
- // Remove a stale connection from the back of the queue
- if (m_queue->size() > 0)
- {
- conn = m_queue->back();
-
- if (NULL != conn && conn->IsStale(&now))
- {
- m_queue->pop_back();
- SAFE_RELEASE(conn);
- conn = NULL;
- }
- }
-
-
// Pull a connection from the front of the queue and make sure it's valid.
conn = NULL;
while (NULL == conn && m_queue->size() > 0)
@@ -215,3 +201,26 @@
SAFE_ADDREF(connection);
m_inUse->push_back(connection);
}
+
+void MgServerConnectionStack::CloseStaleConnections(ACE_Time_Value* timeValue)
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ // Remove a stale connection from the back of the queue
+ // Work from the back of the queue until the connections are not stale
+ while (m_queue->size() > 0)
+ {
+ MgServerConnection* conn = m_queue->back();
+
+ if (NULL != conn && conn->IsStale(timeValue))
+ {
+ m_queue->pop_back();
+ SAFE_RELEASE(conn);
+ conn = NULL;
+ }
+ else
+ {
+ break;
+ }
+ }
+}
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.h
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.h 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ServerConnectionStack.h 2010-03-22 17:54:24 UTC (rev 4681)
@@ -82,6 +82,11 @@
///
void InUse(MgServerConnection* connection);
+ /// \brief
+ /// Close stale connections
+ ///
+ void CloseStaleConnections(ACE_Time_Value* timeValue);
+
private:
typedef std::deque<MgServerConnection*> ConnectionQueue;
Modified: sandbox/adsk/2.2gp/Server/src/Common/Base/ClientHandler.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Common/Base/ClientHandler.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Server/src/Common/Base/ClientHandler.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -65,20 +65,6 @@
/// </summary>
MgClientHandler::~MgClientHandler()
{
- // close writer and listen for ack
- m_SockStream.close_writer();
-
- char buf[256];
-
- ssize_t len = 0;
- while ((len = m_SockStream.recv((void*)buf, 256, MG_MSG_NOSIGNAL)) > 0)
- {
- // clearing out buffer
- }
-
- m_SockStream.close_reader();
- m_SockStream.close();
-
m_pMessageQueue = NULL;
if (m_pConnection != NULL)
@@ -264,6 +250,7 @@
m_SockStream.close_writer();
m_SockStream.close_reader();
m_SockStream.close();
+ m_pMessageQueue->flush();
MgServerManager* pServerManager = MgServerManager::GetInstance();
if(pServerManager)
Modified: sandbox/adsk/2.2gp/Web/src/WebSupport/InitializeWebTier.cpp
===================================================================
--- sandbox/adsk/2.2gp/Web/src/WebSupport/InitializeWebTier.cpp 2010-03-22 16:49:37 UTC (rev 4680)
+++ sandbox/adsk/2.2gp/Web/src/WebSupport/InitializeWebTier.cpp 2010-03-22 17:54:24 UTC (rev 4681)
@@ -16,6 +16,7 @@
//
#include "MapGuideCommon.h"
+#include "Services/ServerConnectionPool.h"
// Initialize only once per process
@@ -65,6 +66,9 @@
if (!m_bInitialized)
return;
+ // Close all open connections before we drop ACE
+ MgServerConnectionPool::CloseConnections();
+
// Uninitialize ACE
ACE::fini();
More information about the mapguide-commits
mailing list