mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=6158
This commit is contained in:
parent
5ab0e94a1f
commit
8857f357f7
|
@ -6592,3 +6592,22 @@ Rom 13 May 2005
|
|||
|
||||
client/win/
|
||||
win_screensaver.cpp
|
||||
|
||||
David 14 May 2005
|
||||
- fix bug where multiple scheduler RPCs or master file fetches
|
||||
could be started simultaneously (this is a no-no).
|
||||
- NET_XFER_SET::do_select(): don't add a socket to fd_set
|
||||
if io_done is true.
|
||||
This causes the select() to fail and all I/O locks up.
|
||||
- break out English strings for socket errors
|
||||
into a separate function (socket_error_str())
|
||||
instead of having them embedded in resolve_hostname() (???)
|
||||
|
||||
client/
|
||||
cs_scheduler.C
|
||||
net_xfer.C
|
||||
scheduler_op.C
|
||||
win/
|
||||
wingui_mainwindow.cpp
|
||||
lib/
|
||||
network.C,h
|
||||
|
|
|
@ -569,18 +569,15 @@ bool CLIENT_STATE::scheduler_rpc_poll(double now) {
|
|||
"Insufficient work; requesting more"
|
||||
);
|
||||
}
|
||||
work_need_inform_time = now + 60.0 * 60.0;
|
||||
}
|
||||
action = scheduler_op->init_get_work(false, urgency) ? true : false;
|
||||
}
|
||||
if (!action) {
|
||||
if ((p=next_project_master_pending())) {
|
||||
scheduler_op->init_get_work(true, urgency);
|
||||
action = true;
|
||||
} else if ((p=next_project_sched_rpc_pending())) {
|
||||
scheduler_op->init_return_results(p);
|
||||
action = true;
|
||||
work_need_inform_time = now + 3600;
|
||||
}
|
||||
scheduler_op->init_get_work(false, urgency);
|
||||
} else if (p=next_project_master_pending()) {
|
||||
scheduler_op->init_get_work(true, urgency);
|
||||
action = true;
|
||||
} else if (p=next_project_sched_rpc_pending()) {
|
||||
scheduler_op->init_return_results(p);
|
||||
action = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -119,9 +119,11 @@ int NET_XFER::open_server() {
|
|||
}
|
||||
|
||||
void NET_XFER::close_socket() {
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_NET_XFER);
|
||||
#ifdef WIN32
|
||||
NetClose();
|
||||
#endif
|
||||
scope_messages.printf("NET_XFER_SET::close_socket(): %d\n", socket);
|
||||
if (socket) {
|
||||
boinc_close_socket(socket);
|
||||
socket = 0;
|
||||
|
@ -287,13 +289,16 @@ int NET_XFER_SET::do_select(double& bytes_transferred, double timeout) {
|
|||
nsocks_queried = 0;
|
||||
for (i=0; i<net_xfers.size(); i++) {
|
||||
nxp = net_xfers[i];
|
||||
if (nxp->io_done) continue;
|
||||
if (!nxp->is_connected) {
|
||||
if (nxp->check_timeout(time_passed)) continue;
|
||||
//scope_messages.printf("NET_XFER_SET::do_select(): set %d in write mask\n", nxp->socket);
|
||||
FD_SET(nxp->socket, &write_fds);
|
||||
nsocks_queried++;
|
||||
} else if (nxp->want_download) {
|
||||
if (nxp->check_timeout(time_passed)) continue;
|
||||
if (bytes_left_down > 0) {
|
||||
//scope_messages.printf("NET_XFER_SET::do_select(): set %d in read mask\n", nxp->socket);
|
||||
FD_SET(nxp->socket, &read_fds);
|
||||
nsocks_queried++;
|
||||
} else {
|
||||
|
@ -322,7 +327,12 @@ int NET_XFER_SET::do_select(double& bytes_transferred, double timeout) {
|
|||
nsocks_queried, n
|
||||
);
|
||||
if (n == 0) return 0;
|
||||
if (n < 0) return ERR_SELECT;
|
||||
if (n < 0) {
|
||||
scope_messages.printf(
|
||||
"NET_XFER_SET::do_select(): %s\n", socket_error_str()
|
||||
);
|
||||
return ERR_SELECT;
|
||||
}
|
||||
|
||||
// if got a descriptor, find the first one in round-robin order
|
||||
// and do I/O on it
|
||||
|
|
|
@ -50,7 +50,8 @@ SCHEDULER_OP::SCHEDULER_OP(HTTP_OP_SET* h) {
|
|||
http_ops = h;
|
||||
}
|
||||
|
||||
// see if there's a pending master file fetch. start it if so.
|
||||
// See if there's a pending master file fetch.
|
||||
// If so, start it and return true.
|
||||
//
|
||||
bool SCHEDULER_OP::check_master_fetch_start() {
|
||||
int retval;
|
||||
|
@ -76,12 +77,12 @@ bool SCHEDULER_OP::check_master_fetch_start() {
|
|||
return false;
|
||||
}
|
||||
|
||||
// try to get work, from any project from which we need it
|
||||
// Try to get work, from any project from which we need it
|
||||
// PRECONDITION: compute_work_requests() has been called
|
||||
// to fill in PROJECT::work_request
|
||||
//
|
||||
int SCHEDULER_OP::init_get_work(bool master_file_only, int urgency) {
|
||||
int retval = 0;
|
||||
int retval;
|
||||
char err_msg[256];
|
||||
double ns;
|
||||
|
||||
|
@ -97,11 +98,9 @@ int SCHEDULER_OP::init_get_work(bool master_file_only, int urgency) {
|
|||
return retval;
|
||||
}
|
||||
} else {
|
||||
bool ret = check_master_fetch_start();
|
||||
retval = ret ? 1 : 0;
|
||||
check_master_fetch_start();
|
||||
}
|
||||
|
||||
return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// report results for a particular project.
|
||||
|
|
|
@ -574,7 +574,11 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
|
|||
xSent = f_size;
|
||||
}
|
||||
// if (m_XferListCtrl.GetItemProgress(i, 2) != 100 * xSent / pfx->fip->nbytes)
|
||||
if (pfx->fip->nbytes > 0) {
|
||||
m_XferListCtrl.SetItemProgress(i, 2, 100 * xSent / pfx->fip->nbytes);
|
||||
} else {
|
||||
m_XferListCtrl.SetItemProgress(i, 2, 0);
|
||||
}
|
||||
|
||||
// size
|
||||
char size_buf[256];
|
||||
|
|
|
@ -34,6 +34,50 @@
|
|||
#include "error_numbers.h"
|
||||
#include "network.h"
|
||||
|
||||
char* socket_error_str() {
|
||||
static char buf[80];
|
||||
#ifdef _WIN32
|
||||
int e = WSAGetLastError();
|
||||
switch (e) {
|
||||
case WSANOTINITIALISED:
|
||||
return "WSA not initialized";
|
||||
case WSAENETDOWN:
|
||||
return "the network subsystem has failed";
|
||||
case WSAHOST_NOT_FOUND:
|
||||
return "host name not found";
|
||||
case WSATRY_AGAIN:
|
||||
return "no response from server";
|
||||
case WSANO_RECOVERY:
|
||||
return "a nonrecoverable error occurred";
|
||||
case WSANO_DATA:
|
||||
return "valid name, no data record of requested type";
|
||||
case WSAEINPROGRESS:
|
||||
return "a blocking socket call in progress";
|
||||
case WSAEFAULT:
|
||||
return "invalid part of user address space";
|
||||
case WSAEINTR:
|
||||
return "a blocking socket call was canceled";
|
||||
case WSAENOTSOCK:
|
||||
return "not a socket";
|
||||
}
|
||||
sprintf(buf, "error %d", e);
|
||||
return buf;
|
||||
#else
|
||||
switch (h_errno) {
|
||||
case HOST_NOT_FOUND:
|
||||
return "host not found";
|
||||
case NO_DATA:
|
||||
return "valid name, no data record of requested type";
|
||||
case NO_RECOVERY:
|
||||
return "a nonrecoverable error occurred";
|
||||
case TRY_AGAIN:
|
||||
return "host not found or server failure";
|
||||
}
|
||||
sprintf(buf, "error %d", h_errno);
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
int resolve_hostname(char* hostname, int &ip_addr, char* msg) {
|
||||
|
||||
// if the hostname is in Internet Standard dotted notation,
|
||||
|
@ -49,58 +93,9 @@ int resolve_hostname(char* hostname, int &ip_addr, char* msg) {
|
|||
hostent* hep;
|
||||
hep = gethostbyname(hostname);
|
||||
if (!hep) {
|
||||
int n;
|
||||
|
||||
n = sprintf(msg, "Can't resolve hostname [%s] ", hostname);
|
||||
sprintf(msg, "Can't resolve hostname [%s] %s", hostname, socket_error_str());
|
||||
#ifdef WIN32
|
||||
|
||||
switch (WSAGetLastError()) {
|
||||
case WSANOTINITIALISED:
|
||||
break;
|
||||
case WSAENETDOWN:
|
||||
sprintf(msg+n, "(the network subsystem has failed)");
|
||||
break;
|
||||
case WSAHOST_NOT_FOUND:
|
||||
sprintf(msg+n, "(host name not found)");
|
||||
break;
|
||||
case WSATRY_AGAIN:
|
||||
sprintf(msg+n, "(no response from server)");
|
||||
break;
|
||||
case WSANO_RECOVERY:
|
||||
sprintf(msg+n, "(a nonrecoverable error occurred)");
|
||||
break;
|
||||
case WSANO_DATA:
|
||||
sprintf(msg+n, "(valid name, no data record of requested type)");
|
||||
break;
|
||||
case WSAEINPROGRESS:
|
||||
sprintf(msg+n, "(a blocking socket call in progress)");
|
||||
break;
|
||||
case WSAEFAULT:
|
||||
sprintf(msg+n, "(invalid part of user address space)");
|
||||
break;
|
||||
case WSAEINTR:
|
||||
sprintf(msg+n, "(a blocking socket call was canceled)");
|
||||
break;
|
||||
}
|
||||
NetClose();
|
||||
|
||||
#else
|
||||
|
||||
switch (h_errno) {
|
||||
case HOST_NOT_FOUND:
|
||||
sprintf(msg+n, "(host not found)");
|
||||
break;
|
||||
case NO_DATA:
|
||||
sprintf(msg+n, "(valid name, no data record of requested type)");
|
||||
break;
|
||||
case NO_RECOVERY:
|
||||
sprintf(msg+n, "(a nonrecoverable error occurred)");
|
||||
break;
|
||||
case TRY_AGAIN:
|
||||
sprintf(msg+n, "(host not found or server failure)");
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return ERR_GETHOSTBYNAME;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ extern int boinc_socket(int& sock);
|
|||
extern int boinc_socket_asynch(int sock, bool asynch);
|
||||
extern void boinc_close_socket(int sock);
|
||||
extern int get_socket_error(int fd);
|
||||
extern char* socket_error_str();
|
||||
|
||||
#if defined(_WIN32)
|
||||
typedef int boinc_socklen_t;
|
||||
|
|
Loading…
Reference in New Issue