[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] engine/netio listenresp.cpp,1.8,1.9
From:       svaidhya () helixcommunity ! org
Date:       2010-04-29 23:16:08
Message-ID: 201004292315.o3TNFxc7029017 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/engine/netio
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv20352

Modified Files:
	listenresp.cpp 
Log Message:
Synopsis
========
Bug 260790:     Changing a port value in the ports page gives a conflict error every \
time

Branches: HEAD, 14.0
Suggested Reviewer: Dean

Description
===========

When we tried to change a port from the Admin System the server always returned back \
an error saying Cannot bind to requested Port. This was happening becasue the server \
instead of binding to the new port was binding to the existing port and was getting \
"address already in use" error back, which was propogated to Admin System.

m_pAddr stores the current Address. InitSocket() creates a new Addr and binds to the \
                new port only if m_pAddr is null.
Fix: To back-up m_pAddr and set it to NULL. So that InitSocket() binds to the new \
                port.
       If everything goes fine we just release the old address. If there was some \
error we release  the new address and replace with the old one.

Files Affected
==============
./sds/session/daucplin.cpp

Testing Performed
=================
Unit Tests:
None

Integration Tests:
- Verified that a valid port change request is successful from te Admin system.
  No error messages
  After port change the server binds to new port as expected.

Leak Tests:
None
Performance Tests:
None
Platforms Tested:
RHEL5

QA Hints
===============
n/a



Index: listenresp.cpp
===================================================================
RCS file: /cvsroot/server/engine/netio/listenresp.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- listenresp.cpp	3 Mar 2010 04:58:27 -0000	1.8
+++ listenresp.cpp	29 Apr 2010 23:16:05 -0000	1.9
@@ -195,12 +195,32 @@
         pResponse->SetActiveIntDone(HXR_OK, pName, ul, 0, 0);
         return HXR_OK;
     }
+
+    //PR 260790: If m_pAddr is not null, ::InitSocket() does not recognize it as a 
+    //new port-change request and tries to listen to the existing port and fails.
+    //To avoid this I am setting m_pAddr to NULL so that we attempt to listen to the
+    //new port. In case the request fails we set the Old value back.
+
+    IHXSockAddr* pOldAddr = NULL;
+    pOldAddr = m_pAddr;
+    m_pAddr = NULL;
+
     HX_RESULT res;
     res = InitSocket((UINT16)ul, m_bSSL);
+
+    if (SUCCEEDED(res))
+    {
+        //We would have created a new m_pAddr. We dont need the old one any longer
+        HX_RELEASE(pOldAddr);
+    }
+
     IHXBuffer* pBuf = NULL;
     UINT32 uResCount = 0;
     if (res != HXR_OK)
     {
+        HX_RELEASE(m_pAddr);
+        m_pAddr = pOldAddr;
+ 
         pBuf = new ServerBuffer(TRUE);
         char errstr[256];
         sprintf(errstr, "Cannot bind to port %lu", ul);


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic