From 0c8d6f8026cafd22413060ebb48a2232e910b50a Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 8 Nov 2006 03:50:38 +0000 Subject: [PATCH] Fix NATIVEWRITE errors --- Robust/src/Runtime/socket.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Robust/src/Runtime/socket.c b/Robust/src/Runtime/socket.c index ac05ff89..ec049d16 100644 --- a/Robust/src/Runtime/socket.c +++ b/Robust/src/Runtime/socket.c @@ -4,8 +4,10 @@ #include #include #include +#include #include "SimpleHash.h" #include "GenericHashtable.h" + extern struct RuntimeHash *fdtoobject; int ___ServerSocket______createSocket____I(struct ___ServerSocket___ * sock, int port) { @@ -92,9 +94,15 @@ void ___Socket______nativeWrite_____AR_B(struct ___Socket___ * sock, struct Arra int fd=sock->___fd___; int length=ao->___length___; char * charstr=((char *)& ao->___length___)+sizeof(int); - int bytewritten=write(fd, charstr, length); - if (bytewritten!=length) { - printf("ERROR IN NATIVEWRITE\n"); + while(1) { + int bytewritten=write(fd, charstr, length); + if (bytewritten==-1&&errno==EAGAIN) + continue; + + if (bytewritten!=length) { + perror("ERROR IN NATIVEWRITE"); + } + break; } // flagorand(sock,0,0xFFFFFFFE); } -- 2.34.1