--- a/Socket.st Thu Mar 10 20:13:11 2005 +0100
+++ b/Socket.st Thu Mar 10 21:02:45 2005 +0100
@@ -2462,18 +2462,45 @@
t = __INST(filePointer);
if (t != nil) {
FILE *fp;
-
+ int sock;
+
+ __INST(filePointer) = nil;
fp = __FILEVal(t);
+ sock = SOCKET_FROM_FILE(fp);
+
+# ifdef xxDO_WRAP_CALLS
+ { int ret;
+
+ /* !!! Must fclose before closesocket !!! */
+ do {
+ __threadErrno = 0;
+ ret = STX_C_CALL1("fclose", fclose, fp);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+
+# ifdef WIN32
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1("closesocket", closesocket, sock);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+ closesocket(sock);
+# endif
+ }
+# else /* !DO_WRAP_CALLS */
+
DBGFPRINTF((stderr, "socket fclose %x (%d)\n", fp, fileno(fp)));
fflush(fp);
/* shutdown(fileno(fp), 2); */
if (@global(FileOpenTrace) == true) {
fprintf(stderr, "fclose [Socket] %x\n", fp);
}
+# ifdef WIN32
+ closesocket(sock);
+# endif
fclose(fp);
- __INST(filePointer) = nil;
+
+# endif /* !DO_WRAP_CALLS */
}
-#endif
+#endif /* NO_SOCKET */
%}
! !
@@ -3882,5 +3909,5 @@
!Socket class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.213 2005-03-10 19:13:11 penk Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.214 2005-03-10 20:02:45 cg Exp $'
! !