upload fix

svn path=/trunk/boinc/; revision=1126
This commit is contained in:
Eric Heien 2003-04-02 00:25:00 +00:00
parent 9b2060486b
commit b7de99fec3
2 changed files with 7 additions and 2 deletions

View File

@ -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;

View File

@ -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;