summaryrefslogtreecommitdiff
path: root/Bus/Ivy/ThreadedSocket.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:05:26 +0000
committerfcolin2007-02-01 13:05:26 +0000
commit215431343127695c76e29a6a8d25e69639be3a33 (patch)
tree233416649f76e6341d6fdb05435ec6db67ef2f50 /Bus/Ivy/ThreadedSocket.cxx
parentc2bb70794d78f4eb33a9915023b8c7b6924b50ef (diff)
downloadivy-cplusplus-215431343127695c76e29a6a8d25e69639be3a33.zip
ivy-cplusplus-215431343127695c76e29a6a8d25e69639be3a33.tar.gz
ivy-cplusplus-215431343127695c76e29a6a8d25e69639be3a33.tar.bz2
ivy-cplusplus-215431343127695c76e29a6a8d25e69639be3a33.tar.xz
Utilisateur : Fcolin Date : 9/02/04 Heure : 16:14 Archivé dans $/Bus/Ivy Commentaire: (vss 20)
Diffstat (limited to 'Bus/Ivy/ThreadedSocket.cxx')
-rw-r--r--Bus/Ivy/ThreadedSocket.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/Bus/Ivy/ThreadedSocket.cxx b/Bus/Ivy/ThreadedSocket.cxx
index 2f32a26..3934095 100644
--- a/Bus/Ivy/ThreadedSocket.cxx
+++ b/Bus/Ivy/ThreadedSocket.cxx
@@ -128,8 +128,11 @@ void CThreadedSocket::Close()
if (m_hSocket != INVALID_SOCKET)
{
//ASSERT(SOCKET_ERROR != closesocket(m_hSocket));
- closesocket(m_hSocket); // close silently
+ SOCKET temp = m_hSocket; // Thread ACK
m_hSocket = INVALID_SOCKET;
+ TRACE( "CThreadedSocket::Close (reader=0x%0x) (writer=0x%0x)%\n", reader_id, writer_id );
+ closesocket(temp); // close silently
+
//if ( thread ) // On fait de l'auto delete mais dans le cas de terminaison anormale l'object reste ????!!!
// delete thread;
// TRACE("CThreadedSocket waiting for thread end ...\n");
@@ -417,9 +420,9 @@ UINT CThreadedSocket::SocketReader( )
break;
case SOCKET_ERROR:
- TRACE( "CThreadedSocket::SocketReader( select error thread_id =( %d) )\n",reader_id);
-
- Close();
+ TRACE( "CThreadedSocket::SocketReader( select error thread_id =( 0x%x) )\n",reader_id);
+ if ( (sock_err != WSAENOTSOCK ) && ( m_hSocket != INVALID_SOCKET )) // could be Invalid if close when in select
+ Close();
h_reader = NULL;
return sock_err;
break;
@@ -512,7 +515,8 @@ UINT CThreadedSocket::SocketWriter( )
break;
case SOCKET_ERROR:
TRACE( "CThreadedSocketException( select )\n");
- if (m_hSocket != INVALID_SOCKET) Close();
+ if ( (sock_err != WSAENOTSOCK ) && ( m_hSocket != INVALID_SOCKET )) // could be Invalid if close when in select
+ Close();
h_reader = NULL;
return sock_err;
break;