You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2004/11/10 09:30:22 UTC
cvs commit: ws-axis/c/src/transport/axis2 Axis2Transport.cpp Axis2Transport.h Channel.cpp
samisa 2004/11/10 00:30:22
Modified: c/src/transport/axis2 Axis2Transport.cpp Axis2Transport.h
Channel.cpp
Log:
Resolved the problem of unused sockets not being closed in case of 'Connection: close'. Also some variable name changes for more readability.
Revision Changes Path
1.17 +7 -7 ws-axis/c/src/transport/axis2/Axis2Transport.cpp
Index: Axis2Transport.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Axis2Transport.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Axis2Transport.cpp 10 Nov 2004 08:02:53 -0000 1.16
+++ Axis2Transport.cpp 10 Nov 2004 08:30:22 -0000 1.17
@@ -33,7 +33,7 @@
/*
* Axis2Transport constuctor
*/
-Axis2Transport::Axis2Transport ():m_bURIChanged (false),
+Axis2Transport::Axis2Transport ():m_bReopenConnection (false),
m_strHTTPProtocol ("HTTP/1.1"),
m_strHTTPMethod ("POST"),
m_bChunked (false),
@@ -103,7 +103,7 @@
{
m_pChannel->setURL (pcEndpointUri);
- m_bURIChanged = true;
+ m_bReopenConnection = true;
// Check if the new URI requires SSL (denoted by the https prefix).
if ((m_pChannel->getURLObject ()).getProtocol () == URL::https)
@@ -189,9 +189,9 @@
Axis2Transport::flushOutput ()
throw (AxisTransportException)
{
- if (m_bURIChanged)
+ if (m_bReopenConnection)
{
- m_bURIChanged = false;
+ m_bReopenConnection = false;
if (!m_pChannel->open ())
{
int iStringLength = m_pChannel->GetLastError ().length () + 1;
@@ -1080,18 +1080,18 @@
// if HTTP/1.0 we have to always close the connection by default
if (m_eProtocolType == APTHTTP1_0)
- m_bURIChanged = true;
+ m_bReopenConnection = true;
// if HTTP/1.1 we have to assume persistant connection by default
// We need to close the connection and open a new one if we have 'Connection: close'
if (key == "Connection" && value == " close" )
- m_bURIChanged = true;
+ m_bReopenConnection = true;
// For both HTTP/1.0 and HTTP/1.1,
// We need to keep the connection if we have 'Connection: Keep-Alive'
if (key == "Connection" && value == " Keep-Alive" )
- m_bURIChanged = false;
+ m_bReopenConnection = false;
}
while (iPosition != std::string::npos);
}
1.11 +4 -3 ws-axis/c/src/transport/axis2/Axis2Transport.h
Index: Axis2Transport.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Axis2Transport.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Axis2Transport.h 10 Nov 2004 04:13:42 -0000 1.10
+++ Axis2Transport.h 10 Nov 2004 08:30:22 -0000 1.11
@@ -126,11 +126,12 @@
int FindTransportPropertyIndex (std::string);
/**
- * Keeps track of URI changes.
+ * Keeps track of if we need to reopen connection.
* Set true by setEndpointUri.
- * Set false when a socket connection is established with the enpoint.
+ * Set false when a socket connection is established with the enpoint and
+ * when there is no need renew (that is close and open again) an existing connection.
*/
- bool m_bURIChanged;
+ bool m_bReopenConnection;
/**
* Message string to be sent.
1.6 +3 -0 ws-axis/c/src/transport/axis2/Channel.cpp
Index: Channel.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Channel.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Channel.cpp 3 Nov 2004 13:23:14 -0000 1.5
+++ Channel.cpp 10 Nov 2004 08:30:22 -0000 1.6
@@ -127,6 +127,9 @@
#ifdef FJPDebug
printf( ">Channel::open()\n");
#endif
+ // if there is an open socket already, close it first
+ if (m_Sock != INVALID_SOCKET)
+ closeChannel();
// If the underlying socket transport has not been initialised properly,
// then thrown an exeption.