2004-11-12 18:11:31 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
2003-07-01 20:37:09 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2002-04-30 22:22:54 +00:00
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
2003-07-01 20:37:09 +00:00
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2003-07-02 02:02:18 +00:00
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
2003-07-02 02:02:18 +00:00
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
2003-07-02 02:02:18 +00:00
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
2002-05-17 22:33:57 +00:00
|
|
|
// command-line version of the BOINC core client
|
|
|
|
|
2002-10-13 21:51:23 +00:00
|
|
|
// This file contains no GUI-related code,
|
|
|
|
// and is not included in the source code for Mac or Win GUI clients
|
2002-08-09 21:43:19 +00:00
|
|
|
|
2004-01-15 01:42:49 +00:00
|
|
|
#ifdef WIN32
|
2004-06-16 23:16:08 +00:00
|
|
|
#include "boinc_win.h"
|
2004-01-19 20:53:40 +00:00
|
|
|
#include "win_service.h"
|
2004-06-09 18:17:25 +00:00
|
|
|
#include "win_net.h"
|
2004-01-15 01:42:49 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
#ifndef _WIN32
|
2004-03-17 04:56:46 +00:00
|
|
|
#include "config.h"
|
2002-11-18 23:09:11 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2002-04-30 22:22:54 +00:00
|
|
|
#include <unistd.h>
|
2002-11-18 23:09:11 +00:00
|
|
|
#endif
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <csignal>
|
2004-03-25 22:24:33 +00:00
|
|
|
#include "synch.h"
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2003-04-08 18:36:03 +00:00
|
|
|
|
2004-03-24 07:39:24 +00:00
|
|
|
#include "diagnostics.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
#include "client_state.h"
|
|
|
|
#include "error_numbers.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "file_names.h"
|
|
|
|
#include "log_flags.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
#include "prefs.h"
|
2002-06-06 18:50:12 +00:00
|
|
|
#include "util.h"
|
2004-04-08 08:15:23 +00:00
|
|
|
#include "client_msgs.h"
|
2004-05-05 18:43:41 +00:00
|
|
|
#include "main.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-05-10 00:52:36 +00:00
|
|
|
// dummies
|
2003-10-18 19:43:48 +00:00
|
|
|
void guiOnBenchmarksBegin(){}
|
|
|
|
void guiOnBenchmarksEnd(){}
|
2003-04-08 18:36:03 +00:00
|
|
|
|
2003-05-13 18:55:07 +00:00
|
|
|
// This gets called when the client fails to add a project
|
|
|
|
//
|
|
|
|
void project_add_failed(PROJECT* project) {
|
|
|
|
if (project->scheduler_urls.size()) {
|
|
|
|
printf(
|
|
|
|
"BOINC failed to log in to %s.\n "
|
2004-12-01 05:03:53 +00:00
|
|
|
"Please check your account key and try again.\n",
|
2003-05-13 18:55:07 +00:00
|
|
|
project->master_url
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
printf(
|
|
|
|
"BOINC couldn't get main page for %s.\n"
|
|
|
|
"Please check the URL and try again.\n",
|
|
|
|
project->master_url
|
|
|
|
);
|
|
|
|
}
|
2003-05-14 21:17:58 +00:00
|
|
|
gstate.detach_project(project);
|
2004-07-06 18:09:30 +00:00
|
|
|
gstate.quit_activities();
|
2003-05-13 18:55:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2002-12-17 19:00:43 +00:00
|
|
|
// Display a message to the user.
|
|
|
|
// Depending on the priority, the message may be more or less obtrusive
|
2002-07-15 23:21:20 +00:00
|
|
|
//
|
2003-05-21 17:59:10 +00:00
|
|
|
void show_message(PROJECT *p, char* msg, int priority) {
|
2003-05-13 18:55:07 +00:00
|
|
|
char* x;
|
2003-05-21 17:59:10 +00:00
|
|
|
char message[1024];
|
2004-04-01 23:19:13 +00:00
|
|
|
time_t now = time(0);
|
|
|
|
char* time_string = time_to_string(now);
|
2004-01-22 06:37:16 +00:00
|
|
|
#if defined(WIN32) && defined(_CONSOLE)
|
2004-01-19 20:53:40 +00:00
|
|
|
char event_message[2048];
|
2004-01-22 06:37:16 +00:00
|
|
|
#endif
|
2003-05-21 17:59:10 +00:00
|
|
|
|
|
|
|
strcpy(message, msg);
|
2004-04-20 05:10:40 +00:00
|
|
|
while (strlen(message)&&message[strlen(message)-1] == '\n') {
|
2003-05-21 17:59:10 +00:00
|
|
|
message[strlen(message)-1] = 0;
|
|
|
|
}
|
|
|
|
|
2003-05-13 18:55:07 +00:00
|
|
|
if (p) {
|
|
|
|
x = p->get_project_name();
|
|
|
|
} else {
|
2004-03-23 01:44:47 +00:00
|
|
|
x = "---";
|
2003-05-13 18:55:07 +00:00
|
|
|
}
|
2004-04-01 23:19:13 +00:00
|
|
|
|
2004-06-17 04:49:34 +00:00
|
|
|
record_message(p, priority, now, message);
|
2004-04-01 23:19:13 +00:00
|
|
|
|
2003-03-06 17:42:49 +00:00
|
|
|
switch (priority) {
|
|
|
|
case MSG_ERROR:
|
2004-04-01 23:19:13 +00:00
|
|
|
fprintf(stderr, "%s [%s] %s\n", time_string, x, message);
|
|
|
|
printf("%s [%s] %s\n", time_string, x, message);
|
2004-12-06 22:41:19 +00:00
|
|
|
if (gstate.executing_as_windows_service) {
|
2004-01-22 06:37:16 +00:00
|
|
|
#if defined(WIN32) && defined(_CONSOLE)
|
2004-12-06 22:41:19 +00:00
|
|
|
_stprintf(event_message, TEXT("%s [%s] %s\n"), time_string, x, message);
|
2004-08-24 21:29:14 +00:00
|
|
|
// TODO: Refactor messages so that we do not overload the event log
|
|
|
|
// RTW 08/24/2004
|
2004-12-06 22:41:19 +00:00
|
|
|
//LogEventErrorMessage(event_message);
|
2004-01-19 20:53:40 +00:00
|
|
|
#endif
|
2004-12-06 22:41:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-01-19 20:53:40 +00:00
|
|
|
case MSG_WARNING:
|
2004-04-01 23:19:13 +00:00
|
|
|
printf("%s [%s] %s\n", time_string, x, message);
|
2004-12-06 22:41:19 +00:00
|
|
|
if (gstate.executing_as_windows_service) {
|
2004-01-22 06:37:16 +00:00
|
|
|
#if defined(WIN32) && defined(_CONSOLE)
|
2004-12-06 22:41:19 +00:00
|
|
|
_stprintf(event_message, TEXT("%s [%s] %s\n"), time_string, x, message);
|
2004-08-24 21:29:14 +00:00
|
|
|
// TODO: Refactor messages so that we do not overload the event log
|
|
|
|
// RTW 08/24/2004
|
2004-12-06 22:41:19 +00:00
|
|
|
//LogEventWarningMessage(event_message);
|
2004-01-19 20:53:40 +00:00
|
|
|
#endif
|
2004-12-06 22:41:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-01-19 20:53:40 +00:00
|
|
|
case MSG_INFO:
|
2004-04-01 23:19:13 +00:00
|
|
|
printf("%s [%s] %s\n", time_string, x, message);
|
2004-12-06 22:41:19 +00:00
|
|
|
if (gstate.executing_as_windows_service) {
|
2004-01-22 06:37:16 +00:00
|
|
|
#if defined(WIN32) && defined(_CONSOLE)
|
2004-12-06 22:41:19 +00:00
|
|
|
_stprintf(event_message, TEXT("%s [%s] %s\n"), time_string, x, message);
|
2004-08-24 21:29:14 +00:00
|
|
|
// TODO: Refactor messages so that we do not overload the event log
|
|
|
|
// RTW 08/24/2004
|
2004-12-06 22:41:19 +00:00
|
|
|
//LogEventInfoMessage(event_message);
|
2004-01-19 20:53:40 +00:00
|
|
|
#endif
|
2004-12-06 22:41:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-05-17 22:33:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-21 06:52:47 +00:00
|
|
|
// Prompt user for project URL and authenticator,
|
2002-09-26 05:57:10 +00:00
|
|
|
// and create an account file
|
2002-06-21 06:52:47 +00:00
|
|
|
//
|
2002-12-19 22:43:38 +00:00
|
|
|
int add_new_project() {
|
2004-12-06 22:41:19 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
return 0;
|
|
|
|
#else
|
2003-05-13 18:55:07 +00:00
|
|
|
PROJECT project;
|
2002-06-21 06:52:47 +00:00
|
|
|
|
|
|
|
printf("Enter the URL of the project: ");
|
2003-05-13 18:55:07 +00:00
|
|
|
scanf("%s", project.master_url);
|
2002-06-21 06:52:47 +00:00
|
|
|
printf(
|
|
|
|
"You should have already registered with the project\n"
|
2002-12-11 19:33:43 +00:00
|
|
|
"and received an account key by email.\n"
|
2003-02-20 00:58:55 +00:00
|
|
|
"Paste the account key here: "
|
2002-06-21 06:52:47 +00:00
|
|
|
);
|
2003-05-13 18:55:07 +00:00
|
|
|
scanf("%s", project.authenticator);
|
2002-06-21 06:52:47 +00:00
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
if (!strlen(project.master_url) || !strlen(project.authenticator)) {
|
|
|
|
printf("URL and account key must be nonempty\n");
|
|
|
|
return ERR_INVALID_URL;
|
|
|
|
}
|
|
|
|
|
2003-05-13 18:55:07 +00:00
|
|
|
project.tentative = true;
|
2004-09-22 21:08:26 +00:00
|
|
|
return project.write_account_file();
|
2004-11-12 18:11:31 +00:00
|
|
|
#endif
|
2002-06-21 06:52:47 +00:00
|
|
|
}
|
|
|
|
|
2004-01-22 06:37:16 +00:00
|
|
|
#ifdef WIN32
|
2004-05-05 18:43:41 +00:00
|
|
|
void quit_client() {
|
|
|
|
gstate.requested_exit = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void suspend_client() {
|
2004-05-05 20:23:52 +00:00
|
|
|
gstate.user_run_request = USER_RUN_REQUEST_NEVER;
|
2004-05-05 18:43:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void resume_client() {
|
2004-05-05 20:23:52 +00:00
|
|
|
gstate.user_run_request = USER_RUN_REQUEST_AUTO;
|
2004-05-05 18:43:41 +00:00
|
|
|
}
|
|
|
|
|
2004-01-15 01:42:49 +00:00
|
|
|
BOOL WINAPI ConsoleControlHandler ( DWORD dwCtrlType ){
|
2004-12-06 22:41:19 +00:00
|
|
|
BOOL bReturnStatus = FALSE;
|
|
|
|
switch( dwCtrlType ){
|
2004-04-03 00:43:55 +00:00
|
|
|
case CTRL_C_EVENT:
|
|
|
|
if(gstate.activities_suspended) {
|
2004-05-05 18:43:41 +00:00
|
|
|
resume_client();
|
2004-04-03 00:43:55 +00:00
|
|
|
} else {
|
2004-05-05 18:43:41 +00:00
|
|
|
suspend_client();
|
2004-04-03 00:43:55 +00:00
|
|
|
}
|
|
|
|
bReturnStatus = TRUE;
|
|
|
|
break;
|
|
|
|
case CTRL_BREAK_EVENT:
|
|
|
|
case CTRL_CLOSE_EVENT:
|
|
|
|
case CTRL_SHUTDOWN_EVENT:
|
2004-05-05 18:43:41 +00:00
|
|
|
quit_client();
|
2004-04-03 00:43:55 +00:00
|
|
|
bReturnStatus = TRUE;
|
|
|
|
break;
|
2004-07-07 18:35:25 +00:00
|
|
|
case CTRL_LOGOFF_EVENT:
|
|
|
|
if (!gstate.executing_as_windows_service) {
|
|
|
|
quit_client();
|
|
|
|
}
|
|
|
|
bReturnStatus = TRUE;
|
|
|
|
break;
|
2004-12-06 22:41:19 +00:00
|
|
|
}
|
|
|
|
return bReturnStatus;
|
2004-01-15 01:42:49 +00:00
|
|
|
}
|
2004-05-05 18:33:42 +00:00
|
|
|
#else
|
|
|
|
static void signal_handler(int signum) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Received signal %d", signum);
|
|
|
|
switch(signum) {
|
|
|
|
case SIGHUP:
|
|
|
|
case SIGINT:
|
|
|
|
case SIGQUIT:
|
|
|
|
case SIGTERM:
|
2004-05-06 00:24:47 +00:00
|
|
|
gstate.requested_exit = true;
|
|
|
|
break;
|
2004-05-05 18:59:37 +00:00
|
|
|
case SIGTSTP:
|
2004-05-06 00:24:47 +00:00
|
|
|
gstate.user_run_request = USER_RUN_REQUEST_NEVER;
|
2004-05-05 18:33:42 +00:00
|
|
|
break;
|
|
|
|
case SIGCONT:
|
2004-05-06 00:24:47 +00:00
|
|
|
gstate.user_run_request = USER_RUN_REQUEST_AUTO;
|
2004-05-05 18:33:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-05-06 00:24:47 +00:00
|
|
|
msg_printf(NULL, MSG_WARNING, "Signal not handled");
|
2004-05-05 18:33:42 +00:00
|
|
|
}
|
|
|
|
}
|
2003-06-06 21:27:32 +00:00
|
|
|
#endif
|
2003-06-04 18:51:16 +00:00
|
|
|
|
2004-03-29 23:22:19 +00:00
|
|
|
int boinc_main_loop(int argc, char** argv) {
|
2004-12-06 22:41:19 +00:00
|
|
|
int retval;
|
2003-02-26 00:47:57 +00:00
|
|
|
double dt;
|
2002-07-29 00:39:45 +00:00
|
|
|
|
2002-08-12 23:18:47 +00:00
|
|
|
setbuf(stdout, 0);
|
2003-06-04 18:51:16 +00:00
|
|
|
|
2004-03-25 22:24:33 +00:00
|
|
|
boinc_init_diagnostics(
|
2004-12-06 22:41:19 +00:00
|
|
|
BOINC_DIAG_DUMPCALLSTACKENABLED
|
|
|
|
| BOINC_DIAG_HEAPCHECKENABLED
|
|
|
|
| BOINC_DIAG_TRACETOSTDERR
|
|
|
|
#ifdef _WIN32
|
|
|
|
| BOINC_DIAG_REDIRECTSTDERR
|
|
|
|
| BOINC_DIAG_REDIRECTSTDOUT
|
|
|
|
#endif
|
2004-03-25 22:24:33 +00:00
|
|
|
);
|
2004-03-24 07:39:24 +00:00
|
|
|
|
2004-09-06 20:30:22 +00:00
|
|
|
retval = check_unique_instance();
|
|
|
|
if (retval) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Another instance of BOINC is running");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2004-01-15 01:42:49 +00:00
|
|
|
// Unix/Linux console controls
|
|
|
|
#ifndef WIN32
|
2003-04-08 18:36:03 +00:00
|
|
|
// Handle quit signals gracefully
|
2004-05-05 18:33:42 +00:00
|
|
|
boinc_set_signal_handler(SIGHUP, signal_handler);
|
|
|
|
boinc_set_signal_handler(SIGINT, signal_handler);
|
|
|
|
boinc_set_signal_handler(SIGQUIT, signal_handler);
|
|
|
|
boinc_set_signal_handler(SIGTERM, signal_handler);
|
2003-06-05 19:00:05 +00:00
|
|
|
#ifdef SIGPWR
|
2004-05-05 18:33:42 +00:00
|
|
|
boinc_set_signal_handler(SIGPWR, signal_handler);
|
2003-06-05 19:00:05 +00:00
|
|
|
#endif
|
2004-10-12 20:56:44 +00:00
|
|
|
//boinc_set_signal_handler_force(SIGTSTP, signal_handler);
|
|
|
|
//boinc_set_signal_handler_force(SIGCONT, signal_handler);
|
2003-04-29 19:53:18 +00:00
|
|
|
#endif
|
2003-04-08 18:36:03 +00:00
|
|
|
|
2004-01-15 01:42:49 +00:00
|
|
|
// Windows console controls
|
|
|
|
#ifdef WIN32
|
|
|
|
if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleControlHandler, TRUE)){
|
|
|
|
fprintf(stderr, "Failed to register the console control handler\n");
|
|
|
|
exit(1);
|
2004-12-06 22:41:19 +00:00
|
|
|
} else {
|
|
|
|
printf(
|
|
|
|
"\nTo pause/resume tasks hit CTRL-C, to exit hit CTRL-BREAK\n"
|
|
|
|
);
|
|
|
|
}
|
2004-01-15 01:42:49 +00:00
|
|
|
#endif
|
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
read_log_flags();
|
2004-01-15 01:42:49 +00:00
|
|
|
gstate.parse_cmdline(argc, argv);
|
|
|
|
gstate.parse_env_vars();
|
|
|
|
retval = gstate.init();
|
2004-04-15 20:42:15 +00:00
|
|
|
if (retval) {
|
|
|
|
fprintf(stderr, "gstate.init() failed: %d\n", retval);
|
|
|
|
exit(retval);
|
|
|
|
}
|
2004-01-15 01:42:49 +00:00
|
|
|
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
while (1) {
|
2004-10-14 22:01:05 +00:00
|
|
|
dt = dtime();
|
|
|
|
if (!gstate.do_something(dt)) {
|
2003-03-03 19:13:16 +00:00
|
|
|
dt = dtime();
|
2004-11-18 22:18:00 +00:00
|
|
|
gstate.net_sleep(0.1);
|
2003-03-03 19:13:16 +00:00
|
|
|
dt = dtime() - dt;
|
2004-04-08 08:15:23 +00:00
|
|
|
log_messages.printf(CLIENT_MSG_LOG::DEBUG_TIME, "SLEPT %f SECONDS\n", dt);
|
2002-04-30 22:22:54 +00:00
|
|
|
fflush(stdout);
|
|
|
|
}
|
2002-08-12 23:18:47 +00:00
|
|
|
|
2003-09-04 20:11:47 +00:00
|
|
|
if (gstate.time_to_exit()) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Time to exit");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (gstate.requested_exit) {
|
2004-05-05 17:48:39 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Exit requested by user");
|
2002-07-01 18:16:31 +00:00
|
|
|
break;
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
}
|
2004-05-05 17:48:39 +00:00
|
|
|
gstate.quit_activities();
|
2004-01-15 01:42:49 +00:00
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
return 0;
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2004-01-19 20:53:40 +00:00
|
|
|
|
|
|
|
|
2004-01-22 06:37:16 +00:00
|
|
|
#if defined(WIN32) && defined(_CONSOLE)
|
2004-01-19 20:53:40 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// On Windows, we support running as a Windows Service which requires
|
|
|
|
// a different startup method
|
|
|
|
//
|
|
|
|
int main(int argc, char** argv) {
|
2004-12-06 22:41:19 +00:00
|
|
|
int retval = 0;
|
2004-01-19 20:53:40 +00:00
|
|
|
|
2004-06-09 18:17:25 +00:00
|
|
|
// Initialize WinSock
|
|
|
|
if ( WinsockInitialize() != 0 ) {
|
|
|
|
printf(
|
|
|
|
"BOINC Core Client Error Message\n"
|
|
|
|
"Failed to initialize the Windows Sockets interface\n"
|
|
|
|
"Terminating Application...\n"
|
|
|
|
);
|
|
|
|
return ERR_IO;
|
|
|
|
}
|
|
|
|
|
|
|
|
SERVICE_TABLE_ENTRY dispatchTable[] = {
|
2004-12-06 22:41:19 +00:00
|
|
|
{ TEXT(SZSERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
2004-01-19 20:53:40 +00:00
|
|
|
|
2004-03-19 00:13:22 +00:00
|
|
|
if ( (argc > 1) && ((*argv[1] == '-') || (*argv[1] == '/')) ) {
|
2004-11-12 18:11:31 +00:00
|
|
|
if ( _stricmp( "win_service", argv[1]+1 ) == 0 ) {
|
2004-04-29 00:57:26 +00:00
|
|
|
|
|
|
|
// allow the system to know it is running as a Windows service
|
|
|
|
// and adjust it's diagnostics schemes accordingly.
|
|
|
|
gstate.executing_as_windows_service = true;
|
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
printf( "\nStartServiceCtrlDispatcher being called.\n" );
|
|
|
|
printf( "This may take several seconds. Please wait.\n" );
|
2004-01-19 20:53:40 +00:00
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
if (!StartServiceCtrlDispatcher(dispatchTable)) {
|
|
|
|
LogEventErrorMessage(TEXT("StartServiceCtrlDispatcher failed."));
|
2004-03-19 00:13:22 +00:00
|
|
|
}
|
|
|
|
} else {
|
2004-12-06 22:41:19 +00:00
|
|
|
retval = boinc_main_loop(argc, argv);
|
|
|
|
}
|
2004-03-19 00:13:22 +00:00
|
|
|
} else {
|
2004-12-06 22:41:19 +00:00
|
|
|
retval = boinc_main_loop(argc, argv);
|
|
|
|
}
|
2004-01-19 20:53:40 +00:00
|
|
|
|
2004-06-10 07:49:50 +00:00
|
|
|
if ( WinsockCleanup() != 0 ) {
|
2004-06-09 18:17:25 +00:00
|
|
|
printf(
|
|
|
|
"BOINC Core Client Error Message\n"
|
|
|
|
"Failed to cleanup the Windows Sockets interface\n"
|
|
|
|
);
|
|
|
|
return ERR_IO;
|
|
|
|
}
|
|
|
|
|
2004-03-19 00:13:22 +00:00
|
|
|
return retval;
|
2004-01-19 20:53:40 +00:00
|
|
|
}
|
|
|
|
|
2004-01-22 02:00:20 +00:00
|
|
|
#else
|
2004-01-19 20:53:40 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// For platforms other than windows just treat it as a console application
|
|
|
|
//
|
|
|
|
int main(int argc, char** argv) {
|
2004-12-06 22:41:19 +00:00
|
|
|
return boinc_main_loop(argc, argv);
|
2004-01-19 20:53:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2004-12-08 00:40:19 +00:00
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
static volatile const char __attribute__((unused)) *BOINCrcsid="$Id$";
|
|
|
|
#else
|
|
|
|
static volatile const char *BOINCrcsid="$Id$";
|
|
|
|
#endif
|