Fixes for mbtask
This commit is contained in:
parent
17fda57677
commit
fb9122255c
@ -9,6 +9,10 @@ v0.83.13 13-Feb-2006
|
||||
mbcico:
|
||||
Added real error message for failed outgoing IP connections.
|
||||
|
||||
mbtask:
|
||||
Fixed startup problem on new installations.
|
||||
Some code cleanup.
|
||||
|
||||
|
||||
v0.83.12 06-Feb-2006 - 13-Feb-2006
|
||||
|
||||
|
@ -112,16 +112,9 @@ extern int ipmailers; /* TCP/IP mail sessions */
|
||||
extern int tosswait; /* Toss wait timer */
|
||||
extern pid_t mypid; /* Pid of daemon */
|
||||
int G_Shutdown = FALSE; /* Global shutdown */
|
||||
int T_Shutdown = FALSE; /* Shutdown threads */
|
||||
int nodaemon = FALSE; /* Run in foreground */
|
||||
extern time_t resettime; /* IBC reset time */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Global thread vaiables
|
||||
*/
|
||||
pthread_t pt_ping;
|
||||
int Run_IBC = TRUE; /* Run IBC server */
|
||||
|
||||
|
||||
|
||||
@ -797,13 +790,9 @@ void die(int onsig)
|
||||
/*
|
||||
* Disconnect chatservers
|
||||
*/
|
||||
if (Run_IBC)
|
||||
ibc_shutdown();
|
||||
|
||||
/*
|
||||
* Now stop the threads
|
||||
*/
|
||||
T_Shutdown = TRUE;
|
||||
|
||||
/*
|
||||
* Free memory
|
||||
*/
|
||||
@ -1052,6 +1041,7 @@ void start_scheduler(int port)
|
||||
/*
|
||||
* Setup IBC socket
|
||||
*/
|
||||
if (Run_IBC) {
|
||||
myaddr_in.sin_family = AF_INET;
|
||||
myaddr_in.sin_addr.s_addr = INADDR_ANY;
|
||||
myaddr_in.sin_port = port;
|
||||
@ -1070,6 +1060,7 @@ void start_scheduler(int port)
|
||||
|
||||
srand(getpid());
|
||||
resettime = time(NULL) + (time_t)86400;
|
||||
}
|
||||
|
||||
/*
|
||||
* The flag masterinit is set if a new config.data is created, this
|
||||
@ -1173,7 +1164,8 @@ void scheduler(void)
|
||||
do_cmd(buf);
|
||||
}
|
||||
}
|
||||
if (pfd[1].revents & POLLIN || pfd[1].revents & POLLERR || pfd[1].revents & POLLHUP || pfd[1].revents & POLLNVAL) {
|
||||
if ((pfd[1].revents & POLLIN || pfd[1].revents & POLLERR ||
|
||||
pfd[1].revents & POLLHUP || pfd[1].revents & POLLNVAL) && Run_IBC) {
|
||||
sl = sizeof(myaddr_in);
|
||||
memset(&clientaddr_in, 0, sizeof(struct sockaddr_in));
|
||||
memset(&crbuf, 0, sizeof(crbuf));
|
||||
@ -1199,7 +1191,9 @@ void scheduler(void)
|
||||
/*
|
||||
* Check all registered connections and semafore's
|
||||
*/
|
||||
if (Run_IBC)
|
||||
check_servers();
|
||||
|
||||
reg_check();
|
||||
check_sema();
|
||||
check_ports();
|
||||
@ -1605,24 +1599,6 @@ int main(int argc, char **argv)
|
||||
if (nodaemon)
|
||||
printf("main config loaded\n");
|
||||
|
||||
if ((se = getservbyname("fido", "udp")) == NULL) {
|
||||
fprintf(stderr, "IBC: no fido udp entry in /etc/services, cannot start Internet BBS Chat\n");
|
||||
close(ping_isocket);
|
||||
exit(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
if (strlen(CFG.bbs_name) == 0) {
|
||||
fprintf(stderr, "IBC: mbsetup 1.2.1 is empty, cannot start Internet BBS Chat\n");
|
||||
close(ping_isocket);
|
||||
exit(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
if (strlen(CFG.myfqdn) == 0) {
|
||||
fprintf(stderr, "IBC: mbsetup 1.2.10 is empty, cannot start Internet BBS Chat\n");
|
||||
close(ping_isocket);
|
||||
exit(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
mypid = getpid();
|
||||
if (nodaemon)
|
||||
printf("my pid is %d\n", mypid);
|
||||
@ -1638,6 +1614,17 @@ int main(int argc, char **argv)
|
||||
|
||||
status_init();
|
||||
|
||||
if ((se = getservbyname("fido", "udp")) == NULL) {
|
||||
WriteError("IBC: no fido udp entry in /etc/services, cannot start Internet BBS Chat");
|
||||
Run_IBC = FALSE;
|
||||
} else if (strlen(CFG.bbs_name) == 0) {
|
||||
WriteError("IBC: mbsetup 1.2.1 is empty, cannot start Internet BBS Chat");
|
||||
Run_IBC = FALSE;
|
||||
} else if (strlen(CFG.myfqdn) == 0) {
|
||||
Run_IBC = FALSE;
|
||||
WriteError("IBC: mbsetup 1.2.10 is empty, cannot start Internet BBS Chat");
|
||||
}
|
||||
|
||||
memset(&task, 0, sizeof(task));
|
||||
memset(®info, 0, sizeof(reginfo));
|
||||
memset(&calllist, 0, sizeof(calllist));
|
||||
@ -1718,7 +1705,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
free(lockfile);
|
||||
Syslog('+', "Starting daemon with pid %d", frk);
|
||||
pthread_exit(NULL);
|
||||
exit(MBERR_OK);
|
||||
}
|
||||
}
|
||||
|
@ -401,12 +401,11 @@ void deinit_ping(void)
|
||||
int rc;
|
||||
|
||||
if ((rc = close(ping_isocket))) {
|
||||
WriteError("$ping thread error socket close");
|
||||
WriteError("$ping loop error socket close");
|
||||
}
|
||||
ping_isocket = -1;
|
||||
|
||||
Syslog('+', "Ping thread stopped");
|
||||
Syslog('+', "Ping loop stopped");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -71,6 +71,8 @@ extern chn_list *channels; /* Connected channels */
|
||||
extern int usrchg;
|
||||
extern int chnchg;
|
||||
extern int srvchg;
|
||||
extern int Run_IBC;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -394,6 +396,11 @@ void chat_connect_r(char *data, char *buf)
|
||||
|
||||
Syslog('c', "CCON:%s", data);
|
||||
|
||||
if (! Run_IBC) {
|
||||
snprintf(buf, 200, "100:1,*** Chatserver not configured;");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsSema((char *)"upsalarm")) {
|
||||
snprintf(buf, 200, "100:1,*** Power failure, running on UPS;");
|
||||
return;
|
||||
|
@ -45,7 +45,6 @@ extern int sock; /* Server socket */
|
||||
extern struct sockaddr_un from; /* From socket address */
|
||||
extern int fromlen; /* From address length */
|
||||
extern int logtrans; /* Log transactions */
|
||||
extern int T_Shutdown; /* Program shutdown */
|
||||
|
||||
|
||||
|
||||
|
@ -1460,9 +1460,7 @@ int command_part(char *hostname, char *parameters)
|
||||
}
|
||||
}
|
||||
|
||||
// Syslog('r', "IBC: part input server=%s nick=%s", server, nick);
|
||||
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
||||
// Syslog('r', "IBC: part test server=%s nick=%s name=%s", tmpu->server, tmpu->nick, tmpu->name);
|
||||
if ((strcmp(tmpu->server, server) == 0) && ((strcmp(tmpu->nick, nick) == 0) || (strcmp(tmpu->name, nick) == 0))) {
|
||||
tmpu->channel[0] = '\0';
|
||||
if (message) {
|
||||
|
@ -46,7 +46,6 @@ unsigned int lcrc = 0, tcrc = 1;
|
||||
int lcnt = 0, lchr;
|
||||
static char *pbuff = NULL;
|
||||
|
||||
pthread_mutex_t l_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
|
||||
static char *mon[] = {
|
||||
@ -87,12 +86,6 @@ void Syslog(int grade, const char *format, ...)
|
||||
time_t now;
|
||||
struct tm ptm;
|
||||
|
||||
if (pthread_mutex_lock(&l_mutex)) {
|
||||
perror("");
|
||||
printf("Syslog mutex_lock l_nutex failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
debug = isalpha(grade);
|
||||
va_start(va_ptr, format);
|
||||
vsnprintf(outstr, 1024, format, va_ptr);
|
||||
@ -101,7 +94,6 @@ void Syslog(int grade, const char *format, ...)
|
||||
tcrc = StringCRC32(outstr);
|
||||
if (tcrc == lcrc) {
|
||||
lcnt++;
|
||||
pthread_mutex_unlock(&l_mutex);
|
||||
return;
|
||||
}
|
||||
lcrc = tcrc;
|
||||
@ -113,7 +105,6 @@ void Syslog(int grade, const char *format, ...)
|
||||
umask(oldmask);
|
||||
if (logfile == NULL) {
|
||||
printf("Can't open logfile \"%s\"\n", lname);
|
||||
pthread_mutex_unlock(&l_mutex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -127,7 +118,6 @@ void Syslog(int grade, const char *format, ...)
|
||||
if (!debug) {
|
||||
fclose(logfile);
|
||||
}
|
||||
pthread_mutex_unlock(&l_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -169,7 +159,6 @@ void Syslog(int grade, const char *format, ...)
|
||||
printf("Can't close logfile \"%s\"\n", CFG.debuglog);
|
||||
|
||||
lchr = grade;
|
||||
pthread_mutex_unlock(&l_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user