|
From: Andreas R. <and...@us...> - 2003-11-02 19:52:43
|
Update of /cvsroot/squeak/squeak/platforms/win32/plugins/SocketPlugin
In directory sc8-pr-cvs1:/tmp/cvs-serv11039/plugins/SocketPlugin
Modified Files:
sqWin32NewNet.c
Log Message:
update to 3.6.1
Index: sqWin32NewNet.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/plugins/SocketPlugin/sqWin32NewNet.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** sqWin32NewNet.c 21 Jun 2003 17:06:57 -0000 1.6
--- sqWin32NewNet.c 2 Nov 2003 19:52:39 -0000 1.7
***************
*** 1219,1226 ****
/* printf("Data read (%d) WSAGetLastError (%d)\n", result, WSAGetLastError()); */
/* Check if something went wrong */
if(result <= 0) {
- /* Guard eventual writes to socket state */
- LOCKSOCKET(pss->mutex, INFINITE)
if(result == 0) {
/* UDP doesn't know "other end closed" state */
--- 1219,1228 ----
/* printf("Data read (%d) WSAGetLastError (%d)\n", result, WSAGetLastError()); */
+
+ /* Guard eventual writes to socket state */
+ LOCKSOCKET(pss->mutex, INFINITE)
+
/* Check if something went wrong */
if(result <= 0) {
if(result == 0) {
/* UDP doesn't know "other end closed" state */
***************
*** 1229,1238 ****
} else if(result < 0) {
int err = WSAGetLastError();
! if(err == WSAEWOULDBLOCK) {
! /* no data available -> wake up read watcher */
! pss->sockState &= ~SOCK_DATA_READABLE;
! pss->readWatcherOp = WatchData;
! SetEvent(pss->hReadWatcherEvent);
! } else {
/* printf("ERROR: %d\n", err); */
/* NOTE: We consider all other errors to be fatal, e.g.,
--- 1231,1235 ----
} else if(result < 0) {
int err = WSAGetLastError();
! if(err != WSAEWOULDBLOCK) {
/* printf("ERROR: %d\n", err); */
/* NOTE: We consider all other errors to be fatal, e.g.,
***************
*** 1247,1252 ****
result = 0;
}
- UNLOCKSOCKET(pss->mutex);
}
if(failPrim) FAIL();
return result;
--- 1244,1257 ----
result = 0;
}
}
+
+ if(!socketReadable(pss->s)) {
+ /* no more data to read; wake up read watcher */
+ pss->sockState &= ~SOCK_DATA_READABLE;
+ pss->readWatcherOp = WatchData;
+ SetEvent(pss->hReadWatcherEvent);
+ }
+
+ UNLOCKSOCKET(pss->mutex);
if(failPrim) FAIL();
return result;
***************
*** 1297,1304 ****
}
/* printf("Data sent (%d) WSAGetLastError (%d)\n", result, WSAGetLastError()); */
/* Check if something went wrong */
if(result <= 0) {
- /* Guard eventual writes to socket state */
- LOCKSOCKET(pss->mutex, INFINITE)
if(result == 0) {
/* UDP doesn't know "other end closed" state */
--- 1302,1311 ----
}
/* printf("Data sent (%d) WSAGetLastError (%d)\n", result, WSAGetLastError()); */
+
+ /* Guard eventual writes to socket state */
+ LOCKSOCKET(pss->mutex, INFINITE)
+
/* Check if something went wrong */
if(result <= 0) {
if(result == 0) {
/* UDP doesn't know "other end closed" state */
***************
*** 1307,1316 ****
} else {
int err = WSAGetLastError();
! if(err == WSAEWOULDBLOCK) {
! /* no data available => wake up write watcher */
! pss->sockState &= ~SOCK_DATA_WRITABLE;
! pss->writeWatcherOp = WatchData;
! SetEvent(pss->hWriteWatcherEvent);
! } else {
/* printf("ERROR: %d\n", err); */
/* NOTE: We consider all other errors to be fatal, e.g.,
--- 1314,1318 ----
} else {
int err = WSAGetLastError();
! if(err != WSAEWOULDBLOCK) {
/* printf("ERROR: %d\n", err); */
/* NOTE: We consider all other errors to be fatal, e.g.,
***************
*** 1325,1330 ****
result = 0;
}
- UNLOCKSOCKET(pss->mutex);
}
if(failPrim) FAIL();
return result;
--- 1327,1340 ----
result = 0;
}
}
+
+ if(!socketWritable(pss->s)) {
+ /* can't write more data; wake up write watcher */
+ pss->sockState &= ~SOCK_DATA_WRITABLE;
+ pss->writeWatcherOp = WatchData;
+ SetEvent(pss->hWriteWatcherEvent);
+ }
+
+ UNLOCKSOCKET(pss->mutex);
if(failPrim) FAIL();
return result;
|