--- a/Socket.st Fri Mar 11 10:01:53 2005 +0100
+++ b/Socket.st Fri Mar 11 15:08:20 2005 +0100
@@ -2480,7 +2480,6 @@
# ifdef xxDO_WRAP_CALLS
{ int ret;
- /* !!! Must fclose before closesocket !!! */
do {
__threadErrno = 0;
ret = STX_C_CALL1("fclose", fclose, fp);
@@ -2496,17 +2495,19 @@
}
# else /* !DO_WRAP_CALLS */
- DBGFPRINTF((stderr, "socket fclose %x (%d)\n", fp, fileno(fp)));
+ DBGFPRINTF((stderr, "SOCKET: fflush %x (%d)\n", fp, fileno(fp)));
fflush(fp);
/* shutdown(fileno(fp), 2); */
+# ifdef xxWIN32
+ closesocket(sock);
+# endif
+ DBGFPRINTF((stderr, "SOCKET: fclose %x (%d)\n", fp, sock));
if (@global(FileOpenTrace) == true) {
fprintf(stderr, "fclose [Socket] %x\n", fp);
}
-# ifdef xxWIN32
- closesocket(sock);
-# endif
fclose(fp);
# ifdef WIN32
+ DBGFPRINTF((stderr, "SOCKET: closesocket (%d)\n", sock));
closesocket(sock);
# endif
@@ -2631,19 +2632,19 @@
SOCKET sock;
int ret;
- __INST(filePointer) = nil;
sock = SOCKET_FROM_FILE_OBJECT(fp);
# ifdef DO_WRAP_CALLS
do {
__threadErrno = 0;
+ DBGFPRINTF((stderr, "SOCKET: shutDown...\n"));
ret = STX_WSA_CALL2("shutdown", shutdown, sock, __intVal(howNum));
+ DBGFPRINTF((stderr, "SOCKET: shutDown -> %d (%d)\n", ret, __threadErrno));
} while ((ret < 0) && (__threadErrno == EINTR));
# else
__BEGIN_INTERRUPTABLE__
shutdown(sock, __intVal(howNum));
__END_INTERRUPTABLE__
# endif
- DBGFPRINTF((stderr, "socket shutDown %x (%d)\n", fp, sock));
}
#endif
%}.
@@ -2785,7 +2786,7 @@
} while ((newSock < 0) && (errno == EINTR));
__END_INTERRUPTABLE__
# endif
- DBGFPRINTF((stderr, "socket accept newSock=%d\n", newSock));
+ DBGFPRINTF((stderr, "SOCKET: accept newSock=%d\n", newSock));
if (blocking == false) {
# if defined(O_NDELAY) && defined(SET_NDELAY)
@@ -2855,7 +2856,7 @@
# else
closesocket(newSock);
# endif
- DBGFPRINTF((stderr, "socket close (fdopen failed) (%d)\n", newSock));
+ DBGFPRINTF((stderr, "SOCKET: close (fdopen failed) (%d)\n", newSock));
RETURN (false);
}
@@ -3147,9 +3148,10 @@
*/
# ifdef DO_WRAP_CALLS
do {
+ DBGFPRINTF((stderr, "SOCKET: connect...\n"));
__threadErrno = 0;
ret = STX_WSA_CALL3("connect", connect, sock, &sa, sockaddr_size);
- DBGPRINTF(("SOCKET: connect returns %d\n", ret));
+ DBGFPRINTF((stderr, "SOCKET: connect -> %d (%d)\n", ret, __threadErrno));
} while ((ret < 0) && (__threadErrno == EINTR));
# else
__BEGIN_INTERRUPTABLE__
@@ -3178,12 +3180,12 @@
* This was a nonblocking operation that will take some time.
* Do a select on read to get informed when the operation is ready.
*/
- DBGPRINTF(("SOCKET: isAsync is true\n"));
+ DBGFPRINTF((stderr, "SOCKET: isAsync is true\n"));
isAsync = true;
} else
# endif /* EINPROGRESS or EALREADY */
{
- DBGPRINTF(("SOCKET: connect failed ret=%d errno=%d __threadErrno=%d\n",
+ DBGFPRINTF((stderr, "SOCKET: connect failed ret=%d errno=%d __threadErrno=%d\n",
ret, errno, __threadErrno ));
# ifdef DUMP_ADDRESS
{
@@ -3581,7 +3583,7 @@
# endif
# endif
- DBGFPRINTF((stderr, "socket create newSock=%d\n", sock));
+ DBGFPRINTF((stderr, "SOCKET: create newSock=%d\n", sock));
# ifdef WIN32
if (sock == INVALID_SOCKET)
@@ -3647,7 +3649,7 @@
# else
__BEGIN_INTERRUPTABLE__
closesocket(sock);
- DBGFPRINTF((stderr, "socket close (fdopen failed) (%d)\n", sock));
+ DBGFPRINTF((stderr, "SOCKET: close (fdopen failed) (%d)\n", sock));
__END_INTERRUPTABLE__
# endif
} else {
@@ -3940,5 +3942,5 @@
!Socket class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.216 2005-03-11 09:01:53 penk Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.217 2005-03-11 14:08:20 cg Exp $'
! !