Socket Server code: AcceptEx server memory leak

| 6 Comments

The latest version of The Server Framework contains a memory leak in the CSocketServerEx class. It's quite a good leak, it leaks an IO buffer on every connection attempt. The fix is as follows:

Change this code:

void CStreamSocketServerEx::PostAcceptRequest()
{
   if (m_listeningSocket != INVALID_SOCKET)
   {
      if (m_connectionLimiter.CanCreateConnection())
      {
         IncrementPendingReceives();

         const IFullAddress &address = GetAddress();

         IStreamSocketEx *pSocket = AllocateSocket(CreateSocket(address.Type())).Detach();

         IBuffer *pBuffer = AllocateBuffer();

         pBuffer->SetUserPtr(m_socketIndex, pSocket);

         PostIoOperation(pBuffer, IO_Accept_Request);
      }
      else

to this:

void CStreamSocketServerEx::PostAcceptRequest()
{
   if (m_listeningSocket != INVALID_SOCKET)
   {
      if (m_connectionLimiter.CanCreateConnection())
      {
         IncrementPendingReceives();

         const IFullAddress &address = GetAddress();

         IStreamSocketEx *pSocket = AllocateSocket(CreateSocket(address.Type())).Detach();

         CSmartBuffer buffer(AllocateBuffer());

         buffer.Get()->SetUserPtr(m_socketIndex, pSocket);

         PostIoOperation(buffer.Get(), IO_Accept_Request);
      }
      else

6 Comments

Hi!
How can I obtain the licensed version of the socketserver framework? I didn't find any detail in the blog.

I'll email you details.

Hi,

I am interested in your licensed sockerserver framework as well. Can you send me the details too?

Could you email me the details of your licensed socket server and the price?

thank you!

Howa about the free version?Does the same bug exit?

The free version of the acceptex server hasnt been updated from the original source code and I no longer support it. I've no idea if the bug exists in that version of the code.

Leave a comment