[sipxtapi] r1427 committed - Applied patch from Saab:...

2 views
Skip to first unread message

codesite...@google.com

unread,
Feb 7, 2011, 5:44:00 PM2/7/11
to sipxtapi...@googlegroups.com
Revision: 1427
Author: jaroslavl1
Date: Mon Feb 7 14:39:35 2011
Log: Applied patch from Saab:
- Workaround: If a sip server was unavailable for an extended period of
time, the socket would not reconnect due to maxed out retry count. Trying
to recreate sockets and reinitializing retry counts did not seem to work.
Added a windows specific fix (#ifdef/#endif) that would make
Windows ignore ICPM Port Unreachable messages. May not be a proper fix, but
works for us.
http://code.google.com/p/sipxtapi/source/detail?r=1427

Modified:
/trunk/sipXportLib/include/os/OsDatagramSocket.h
/trunk/sipXportLib/src/os/OsDatagramSocket.cpp

=======================================
--- /trunk/sipXportLib/include/os/OsDatagramSocket.h Fri Jan 25 11:54:11
2008
+++ /trunk/sipXportLib/include/os/OsDatagramSocket.h Mon Feb 7 14:39:35
2011
@@ -79,7 +79,7 @@
//! param: buffer - the bytes to be written to the socket
//! param: bufferLength - the number of bytes contained in buffer
//! param: ipAddress - remote host to send datagram(s) to
- //! param: port - port on the remote host to send the datgram(s)
+ //! param: port - port on the remote host to send the datagram(s)
//! returns: the number of bytes actually written to the socket

virtual int read(char* buffer, int bufferLength);
@@ -140,6 +140,7 @@

virtual UtlBoolean getToSockaddr(void);

+ void makeICMPPortUnreachableResistant();
};

/* ============================ INLINE METHODS
============================ */
=======================================
--- /trunk/sipXportLib/src/os/OsDatagramSocket.cpp Fri Jan 25 11:54:11 2008
+++ /trunk/sipXportLib/src/os/OsDatagramSocket.cpp Mon Feb 7 14:39:35 2011
@@ -22,6 +22,7 @@
#if defined(_WIN32)
# include <winsock2.h>
# include <time.h>
+#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR, 12)
#elif defined(_VXWORKS)
# undef resolvGetHostByName
# include <inetLib.h>
@@ -141,6 +142,8 @@
close();
return error;
}
+
+ makeICMPPortUnreachableResistant();

return 0;
}
@@ -197,7 +200,6 @@
mLocalIp = localHost;
}
#endif
-

error = ::bind( socketDescriptor, (struct sockaddr*) &localAddr,
sizeof(localAddr));
@@ -564,6 +566,19 @@
return FALSE ;
}

+void OsDatagramSocket::makeICMPPortUnreachableResistant()
+{
+#if defined(_WIN32)
+ int newValue = FALSE;
+ unsigned long bytesReturned = 0;
+
+ int error = WSAIoctl(socketDescriptor, SIO_UDP_CONNRESET, &newValue,
sizeof(newValue), NULL, 0, &bytesReturned, NULL, NULL);
+ if(error == SOCKET_ERROR)
+ {
+ osPrintf("WSAIoctl call failed with error: %d in
OsSocket::OsSocket\n", error);
+ }
+#endif
+}

/* ============================ INQUIRY
=================================== */

Reply all
Reply to author
Forward
0 new messages