[Opentnl-cvs] tnl/tnl tnlNetInterface.h,1.5,1.6 udp.cpp,1.7,1.8
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2005-04-28 20:49:53
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9500/tnl Modified Files: tnlNetInterface.h udp.cpp Log Message: Virtualized addConnection and removeConnection on NetInterface bind() failure now creates an invalid socket Index: udp.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/udp.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** udp.cpp 14 Feb 2005 06:15:28 -0000 1.7 --- udp.cpp 28 Apr 2005 20:49:36 -0000 1.8 *************** *** 237,240 **** --- 237,241 ---- if(mPlatformSocket != INVALID_SOCKET) { + TNLLogMessageV(LogUDP, ("%s socket created.", socketType)); S32 error = 0; SOCKADDR address; *************** *** 243,257 **** TNLToSocketAddress(bindAddress, &address, &addressSize); error = bind(mPlatformSocket, &address, addressSize); ! Address boundAddress; - addressSize = sizeof(address); ! getsockname(mPlatformSocket, (PSOCKADDR) &address, &addressSize); ! SocketToTNLAddress(&address, &boundAddress); ! TNLLogMessageV(LogUDP, ("%s socket created - bound to address: %s", socketType, boundAddress.toString())); - // set the send and receive buffer sizes - error = setsockopt(mPlatformSocket, SOL_SOCKET, SO_RCVBUF, (char *) &recvBufferSize, sizeof(recvBufferSize)); if(!error) { --- 244,264 ---- TNLToSocketAddress(bindAddress, &address, &addressSize); error = bind(mPlatformSocket, &address, addressSize); ! Address boundAddress; ! if(!error) ! { ! addressSize = sizeof(address); ! getsockname(mPlatformSocket, (PSOCKADDR) &address, &addressSize); ! SocketToTNLAddress(&address, &boundAddress); ! TNLLogMessageV(LogUDP, ("%s socket bound to address: %s", socketType, boundAddress.toString())); ! // set the send and receive buffer sizes ! error = setsockopt(mPlatformSocket, SOL_SOCKET, SO_RCVBUF, (char *) &recvBufferSize, sizeof(recvBufferSize)); ! } ! else ! TNLLogMessageV(LogUDP, ("%s socket error: unable to bind the socket to the specified address.", socketType)); ! if(!error) { Index: tnlNetInterface.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlNetInterface.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tnlNetInterface.h 3 Jun 2004 00:55:20 -0000 1.5 --- tnlNetInterface.h 28 Apr 2005 20:49:36 -0000 1.6 *************** *** 241,248 **** /// Adds a connection to the internal connection list. ! void addConnection(NetConnection *connection); /// Remove a connection from the list. ! void removeConnection(NetConnection *connection); /// Begins the connection handshaking process for a connection. Called from NetConnection::connect() --- 241,248 ---- /// Adds a connection to the internal connection list. ! virtual void addConnection(NetConnection *connection); /// Remove a connection from the list. ! virtual void removeConnection(NetConnection *connection); /// Begins the connection handshaking process for a connection. Called from NetConnection::connect() |