summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:05:26 +0000
committerfcolin2007-02-01 13:05:26 +0000
commit2fab956d8131fb79a0dce36b34733afc88fe23ca (patch)
tree1d5e9ce6de84215fc5dcb06309812680b5510631
parent9700b7c0d1ec515e0ea59dfa5c7e42acd02815aa (diff)
downloadivy-cplusplus-2fab956d8131fb79a0dce36b34733afc88fe23ca.zip
ivy-cplusplus-2fab956d8131fb79a0dce36b34733afc88fe23ca.tar.gz
ivy-cplusplus-2fab956d8131fb79a0dce36b34733afc88fe23ca.tar.bz2
ivy-cplusplus-2fab956d8131fb79a0dce36b34733afc88fe23ca.tar.xz
Utilisateur : Fcolin Date : 9/02/04 Heure : 16:14 Archivé dans $/Bus/Ivy Commentaire: (vss 20)
-rw-r--r--Ivy/ThreadedSocket.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/Ivy/ThreadedSocket.cxx b/Ivy/ThreadedSocket.cxx
index 2f32a26..3934095 100644
--- a/Ivy/ThreadedSocket.cxx
+++ b/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;