From b7de99fec398be2af0f07b66dd8a2d43b934f366 Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Wed, 2 Apr 2003 00:25:00 +0000 Subject: [PATCH] upload fix svn path=/trunk/boinc/; revision=1126 --- client/app.C | 2 ++ client/net_xfer.C | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/app.C b/client/app.C index 8689dbce61..4c273acb75 100644 --- a/client/app.C +++ b/client/app.C @@ -169,10 +169,12 @@ int ACTIVE_TASK::start(bool first_time) { show_message(wup->project, buf, MSG_ERROR); return ERR_FOPEN; } +#ifndef _WIN32 #ifdef HAVE_SYS_IPC_H aid.shm_key = ftok(init_data_path, slot); #else #error +#endif #endif retval = write_init_data_file(f, aid); if (retval) return retval; diff --git a/client/net_xfer.C b/client/net_xfer.C index ab673de0da..80e5717101 100644 --- a/client/net_xfer.C +++ b/client/net_xfer.C @@ -390,6 +390,7 @@ NET_XFER* NET_XFER_SET::lookup_fd(int fd) { // int NET_XFER::do_xfer(int& nbytes_transferred) { int n, m, nleft, offset; + bool would_block; char buf[MAX_BLOCKSIZE]; nbytes_transferred = 0; @@ -435,17 +436,19 @@ int NET_XFER::do_xfer(int& nbytes_transferred) { while (nleft) { #ifdef _WIN32 n = send(socket, buf+offset, nleft, 0); + would_block = (WSAGetLastError() == WSAEWOULDBLOCK); #else n = write(socket, buf+offset, nleft); + would_block = (errno == EAGAIN); #endif if (log_flags.net_xfer_debug) { printf("wrote %d bytes to socket %d\n", n, socket); } - if (n < 0) { + if (n < 0 && !would_block) { error = ERR_WRITE; io_done = true; break; - } else if (n < nleft) { + } else if (n < nleft || would_block) { fseek( file, n+nbytes_transferred-blocksize, SEEK_CUR ); nbytes_transferred += n; bytes_xferred += n;