Lost of changes
This commit is contained in:
parent
1382701bd8
commit
5a0e317f23
17
ChangeLog
17
ChangeLog
@ -8,16 +8,33 @@ v0.39.7 14-Jan-2004
|
||||
that mbtask didn't exist. It is possible that something is
|
||||
broken now, please report such situations.
|
||||
|
||||
general:
|
||||
In all sources replaced the usleep function with the msleep
|
||||
function. The usleep function will become obsolete someday.
|
||||
|
||||
libcommon.a:
|
||||
In execute and execsh on Linux systems sync() is called before
|
||||
and after running the external program to make sure diskbuffers
|
||||
are committed.
|
||||
Added a milliseconds timer.
|
||||
Before and after execute and execsh a 100 ms pause is inserted
|
||||
to prevent (un)archiver and other errors.
|
||||
|
||||
mbcico:
|
||||
Removed the check to disable calling points.
|
||||
Added a check to see if we get a URL to call other systems.
|
||||
If nodelist info fails, increase error counter in steps of 10.
|
||||
Merged tmail patches from Przemyslaw Kwiatkowski.
|
||||
Fixed nodelocks during session handshake after many years. The
|
||||
problem showed only when mbcico was used together with a mailer
|
||||
on a different OS. When a aka is busy, the aka is now dropped.
|
||||
When all akas are busy, a session is impossible and the session
|
||||
is refused. Thanks to Przemyslaw Kwiatkowski for finding and
|
||||
documenting this bug.
|
||||
The total session avg cps is now corrected with the two seconds
|
||||
session close delay time.
|
||||
During binkp handshake increased the timer of the receiver to
|
||||
avoid handshake timeouts.
|
||||
|
||||
mbfido:
|
||||
Removed sync calls that are now in execute.
|
||||
|
4
TODO
4
TODO
@ -121,7 +121,9 @@ mbcico:
|
||||
U: Fix binkp file resume when mbcico silently dies. Check with the new
|
||||
driver.
|
||||
|
||||
U: Check node locking results for EMSI, YooHoo and FTS-0001 sessions.
|
||||
L: Implement binkp option ND.
|
||||
|
||||
L: Implement binkp zlib compression.
|
||||
|
||||
mbfile:
|
||||
L: Add a check to see if the magic filenames are (still) valid.
|
||||
|
@ -13,51 +13,58 @@
|
||||
<LINK rel=stylesheet HREF="../manual.css">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<PRE>
|
||||
usleep.doc
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<div align='right'><h5>Last update 23-Jan-2004</h5></div>
|
||||
<div align='center'><H1>System load and the usleep() call.</H1></div>
|
||||
|
||||
At some time when developping MBSE BBS I decided that background utilities
|
||||
did't need full speed to do their jobs. BBS utilities under DOS needed
|
||||
to run as fast as possible because you needed to bring the bbs down to run
|
||||
these programs and users couldn't login during that time.
|
||||
|
||||
<p>
|
||||
Starting with mball, the allfiles creator, I inserted code that does usleep(1)
|
||||
after each 5 processed files. The 1 microsecond is not really the time the
|
||||
program pauses, it's probably a lot longer. I think this depends on the
|
||||
hardware type, (Intel, Sparc, Alpha etc) how long GNU/Linux will really suspends
|
||||
executing the utility.
|
||||
|
||||
<p>
|
||||
The program speed downgrade at the development machine that mball needed was
|
||||
3 times the original exection time, while system loading stayed under 30%.
|
||||
At that time the development machine is an 486DX2-66 with a Seagate ST32151N
|
||||
SCSI harddisk.
|
||||
|
||||
<p>
|
||||
The extra usleep code is only active if you run these utils with the -quiet
|
||||
switch and when this is set in mbsetup. See menu 1->5.
|
||||
With this switch, the program is mostly run by cron. If you onmit
|
||||
this switch, this is probably when you start the program manually, it will
|
||||
then always run at full speed, no matter what the setting in mbsetup is.
|
||||
|
||||
<p>
|
||||
If you have a fast system or don't care that the performance of your system
|
||||
drops because of background processing, you can turn this future off with
|
||||
mbsetup in the global section. (menu 1->5).
|
||||
|
||||
<p>
|
||||
Remember, if you have a PII-400 MMX or so with IDE disks, you may still have
|
||||
performance problems and need to set that switch to yes. There is only one
|
||||
way to find out if you need it.
|
||||
|
||||
<p>
|
||||
Well, actually, I tested this on a Dell Latitude PII-266, setting the switch to
|
||||
yes gave better performance then no. Why? The CPU has more time for the slow
|
||||
IDE disk. With the slow switch on programs runs even faster then with the switch
|
||||
off. Modern hardware (PIII and later) may run fine with the slow switch turned
|
||||
off.
|
||||
|
||||
<p>
|
||||
In januari 2004 the usleep code is replaced by a milliseconds timer written
|
||||
around the nanosleep system call. This call conforms to POSIX.1b and is written
|
||||
so that if the timer is interrupted it will resume with the time left to do.
|
||||
The real minimum time the timer runs is 10 ms on Intel systems, see also <b>man
|
||||
nanosleep</b> All usleep(1) calls are now msleep(1) calls, in practice these are
|
||||
pauses of 10 ms.
|
||||
<P>
|
||||
Michiel.
|
||||
|
||||
</PRE>
|
||||
<p>
|
||||
|
||||
<A HREF="index.htm"><IMG SRC="../images/b_arrow.png" ALT="Back" Border="0">Go Back</A>
|
||||
|
||||
</BLOCKQUOTE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
@ -40,7 +40,7 @@ OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJ
|
||||
${DIESEL_OBJS} ${NODELIST_OBJS}
|
||||
HDRS = ${CLCOMM_HDRS} ${COMMON_HDRS} ${DBASE_HDRS} ${MSGBASE_HDRS} ${MBINET_HDRS} \
|
||||
${DIESEL_HDRS} ${NODELIST_HDRS} ${OTHER_HDRS}
|
||||
OTHER = Makefile README ftscprod.007 mkprod.awk \
|
||||
OTHER = Makefile README ftscprod.008 mkprod.awk \
|
||||
README.diesel README.macro Diesel.doc nodelist.conf
|
||||
TARGET = libclcomm.a libcommon.a libdbase.a libmsgbase.a libmbinet.a libdiesel.a \
|
||||
libnodelist.a
|
||||
@ -137,7 +137,7 @@ proglock.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/rec
|
||||
dostran.o: ../config.h libs.h structs.h users.h records.h common.h
|
||||
ftnmsg.o: ../config.h libs.h structs.h common.h clcomm.h
|
||||
mbfile.o: ../config.h libs.h structs.h clcomm.h common.h
|
||||
nodelock.o: ../config.h libs.h structs.h clcomm.h common.h
|
||||
nodelock.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
|
||||
rawio.o: ../config.h libs.h structs.h common.h mberrors.h
|
||||
strcasestr.o: ../config.h libs.h
|
||||
execute.o: ../config.h libs.h structs.h clcomm.h mberrors.h common.h
|
||||
@ -160,7 +160,7 @@ dbmsgs.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs
|
||||
dbnode.o: ../config.h libs.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h
|
||||
dbtic.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbtic.h
|
||||
dbuser.o: ../config.h libs.h structs.h users.h records.h dbcfg.h dbuser.h
|
||||
jammsg.o: ../config.h libs.h clcomm.h msgtext.h msg.h jam.h jammsg.h
|
||||
jammsg.o: ../config.h libs.h clcomm.h msgtext.h structs.h common.h msg.h jam.h jammsg.h
|
||||
msg.o: ../config.h libs.h msgtext.h msg.h clcomm.h structs.h common.h jammsg.h
|
||||
msgtext.o: ../config.h libs.h msgtext.h msg.h
|
||||
nntp.o: ../config.h libs.h structs.h users.h records.h clcomm.h mbinet.h
|
||||
|
@ -512,6 +512,8 @@ void gpt_resettimers(void); /* Reset all timers */
|
||||
int gpt_settimer(int, int); /* Set timer no to time */
|
||||
int gpt_expired(int); /* Is timer expired */
|
||||
int gpt_running(int); /* Is timer running */
|
||||
int msleep(int); /* Milliseconds timer */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -140,7 +140,9 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
|
||||
#ifdef __linux__
|
||||
sync();
|
||||
#endif
|
||||
msleep(100);
|
||||
rc = _execute(cmd, file, pkt, in, out, err);
|
||||
msleep(100);
|
||||
#ifdef __linux
|
||||
sync();
|
||||
#endif
|
||||
@ -215,7 +217,9 @@ int execsh(char *cmd, char *in, char *out, char *err)
|
||||
#ifdef __linux__
|
||||
sync();
|
||||
#endif
|
||||
msleep(100);
|
||||
rc = _execsh(cmd, in, out, err);
|
||||
msleep(100);
|
||||
#ifdef __linux__
|
||||
sync();
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
* MBSE BBS and utilities.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -38,10 +38,13 @@
|
||||
#include "libs.h"
|
||||
#include "clcomm.h"
|
||||
#include "msgtext.h"
|
||||
#include "structs.h"
|
||||
#include "common.h"
|
||||
#include "msg.h"
|
||||
#include "jam.h"
|
||||
#include "jammsg.h"
|
||||
|
||||
|
||||
#define MAX_TEXT 2048
|
||||
|
||||
int fdHdr = -1;
|
||||
@ -400,7 +403,7 @@ int JAM_Lock(unsigned long ulTimeout)
|
||||
WriteError("JAM messagebase is locked by pid %d", fl.l_pid);
|
||||
return FALSE;
|
||||
}
|
||||
usleep(250000);
|
||||
msleep(250);
|
||||
Syslog('m', "JAM messagebase lock attempt %d", Tries);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Basic File I/O
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -193,8 +193,6 @@ long file_crc(char *path, int slow)
|
||||
do {
|
||||
bread = fread(line, 1, 32768, fp);
|
||||
crc = upd_crc32(line, crc, bread);
|
||||
if (slow)
|
||||
usleep(1);
|
||||
Nopper(); // For large files on slow systems.
|
||||
} while (bread > 0);
|
||||
|
||||
|
@ -381,7 +381,7 @@ int Msg_Link(char *Path, int do_quiet, int slow_util)
|
||||
i++;
|
||||
|
||||
if (slow_util && do_quiet && ((i % 5) == 0))
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (((i % 10) == 0) && (!do_quiet)) {
|
||||
printf("%6d / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i, Total);
|
||||
@ -414,7 +414,7 @@ int Msg_Link(char *Path, int do_quiet, int slow_util)
|
||||
}
|
||||
|
||||
if (slow_util && do_quiet && ((i % 5) == 0))
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (((i % 10) == 0) && (!do_quiet)) {
|
||||
printf("%6d / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i, Total);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Raw I/O routines.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -238,7 +238,7 @@ int Waitchar(unsigned char *ch, int wtime)
|
||||
rc = read(ttyfd, ch, 1);
|
||||
if (rc == 1)
|
||||
return rc;
|
||||
usleep(10000);
|
||||
msleep(10);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
39
lib/timers.c
39
lib/timers.c
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: General Purpose Timers
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -127,3 +127,40 @@ int gpt_running(int tno)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Milliseconds timer, returns 0 on success.
|
||||
*/
|
||||
int msleep(int msecs)
|
||||
{
|
||||
int rc;
|
||||
struct timespec req, rem;
|
||||
|
||||
rem.tv_sec = 0;
|
||||
rem.tv_nsec = 0;
|
||||
req.tv_sec = msecs / 1000;
|
||||
req.tv_nsec = (msecs % 1000) * 1000000;
|
||||
|
||||
while (TRUE) {
|
||||
|
||||
rc = nanosleep(&req, &rem);
|
||||
if (rc == 0)
|
||||
break;
|
||||
if ((errno == EINVAL) || (errno == EFAULT)) {
|
||||
WriteError("$msleep(%d)", msecs);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Error was EINTR, run timer again to complete.
|
||||
*/
|
||||
req.tv_sec = rem.tv_sec;
|
||||
req.tv_nsec = rem.tv_nsec;
|
||||
rem.tv_sec = 0;
|
||||
rem.tv_nsec = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,7 +306,7 @@ SM_NAMES
|
||||
SM_EDECL
|
||||
faddr *primary;
|
||||
char *p, *q, *pwd;
|
||||
int i, rc = 0, bufl, cmd, dupe, SendPass = FALSE;
|
||||
int i, rc = 0, bufl, cmd, dupe, SendPass = FALSE, akas = 0;
|
||||
fa_list **tmp, *tmpa;
|
||||
faddr *fa, ra;
|
||||
|
||||
@ -409,20 +409,33 @@ SM_STATE(WaitAddr)
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f));
|
||||
if (nodelock(tmpa->addr, mypid)) {
|
||||
binkp_send_command(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f));
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
tmp = &remote;
|
||||
while (*tmp) {
|
||||
if (nodelock((*tmp)->addr, mypid)) {
|
||||
Syslog('+', "address : %s is locked, removed from aka list",ascfnode((*tmp)->addr,0x1f));
|
||||
tmpa=*tmp;
|
||||
*tmp=(*tmp)->next;
|
||||
free(tmpa);
|
||||
} else {
|
||||
/*
|
||||
* With the loaded flag we prevent removing the noderecord
|
||||
* when the remote presents us an address we don't know about.
|
||||
*/
|
||||
akas++;
|
||||
Syslog('+', "address : %s",ascfnode((*tmp)->addr,0x1f));
|
||||
if (!Loaded) {
|
||||
if (noderecord(tmpa->addr))
|
||||
if (noderecord((*tmp)->addr))
|
||||
Loaded = TRUE;
|
||||
}
|
||||
tmp = &((*tmp)->next);
|
||||
}
|
||||
}
|
||||
|
||||
if (akas == 0) {
|
||||
binkp_send_command(MM_BSY, "All aka's busy");
|
||||
Syslog('+', "Binkp: abort, all aka's are busy");
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
history.aka.zone = remote->addr->zone;
|
||||
@ -578,7 +591,7 @@ SM_NAMES
|
||||
(char *)"Opts"
|
||||
SM_EDECL
|
||||
char *p, *q, *pw;
|
||||
int i, rc, bufl, cmd, dupe, we_have_pwd = FALSE;
|
||||
int i, rc, bufl, cmd, dupe, we_have_pwd = FALSE, akas = 0;
|
||||
fa_list **tmp, *tmpa;
|
||||
faddr *fa;
|
||||
|
||||
@ -667,20 +680,32 @@ SM_STATE(WaitAddr)
|
||||
}
|
||||
}
|
||||
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f));
|
||||
if (nodelock(tmpa->addr, mypid)) {
|
||||
binkp_send_command(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f));
|
||||
SM_ERROR;
|
||||
}
|
||||
tmp = &remote;
|
||||
while (*tmp) {
|
||||
if (nodelock((*tmp)->addr, mypid)) {
|
||||
Syslog('+', "address : %s is locked, removed from aka list",ascfnode((*tmp)->addr,0x1f));
|
||||
tmpa=*tmp;
|
||||
*tmp=(*tmp)->next;
|
||||
free(tmpa);
|
||||
} else {
|
||||
/*
|
||||
* With the loaded flag we prevent removing the noderecord
|
||||
* when the remote presents us an address we don't know about.
|
||||
*/
|
||||
akas++;
|
||||
Syslog('+', "address : %s",ascfnode((*tmp)->addr,0x1f));
|
||||
if (!Loaded) {
|
||||
if (noderecord(tmpa->addr))
|
||||
if (noderecord((*tmp)->addr))
|
||||
Loaded = TRUE;
|
||||
}
|
||||
tmp = &((*tmp)->next);
|
||||
}
|
||||
}
|
||||
|
||||
if (akas == 0) {
|
||||
binkp_send_command(MM_BSY, "All aka's busy");
|
||||
Syslog('+', "Binkp: abort, all aka's are busy");
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
@ -874,7 +899,7 @@ int file_transfer(void)
|
||||
* Nothing done, release
|
||||
*/
|
||||
Syslog('b', "Binkp: NOTHING DONE");
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
break;
|
||||
|
||||
case Receive: Trc = binkp_receiver();
|
||||
@ -1626,7 +1651,7 @@ int binkp_recv_command(char *buf, int *len, int *cmd)
|
||||
if (b0 & 0x80)
|
||||
*cmd = 1;
|
||||
|
||||
b1 = GETCHAR(1);
|
||||
b1 = GETCHAR(BINKP_TIMEOUT / 2);
|
||||
if (tty_status)
|
||||
goto to;
|
||||
|
||||
@ -1725,7 +1750,7 @@ int binkp_poll_frame(void)
|
||||
if (c < 0) {
|
||||
c = -c;
|
||||
if (c == STAT_TIMEOUT) {
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer - modem chat
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -104,7 +104,7 @@ int send_str(char *str, char *Phone)
|
||||
case 's': PUTCHAR(' '); *q++ = ' '; break;
|
||||
case ' ': PUTCHAR(' '); *q++ = ' '; break;
|
||||
case 'd': sleep(1); *q++ = '\\'; *q++ = 'd'; break;
|
||||
case 'p': usleep(250000L); *q++ = '\\'; *q++ = 'p'; break;
|
||||
case 'p': msleep(250); *q++ = '\\'; *q++ = 'p'; break;
|
||||
case 'D': if (Phone) {
|
||||
PUTSTR(Phone);
|
||||
sprintf(q, "%s", Phone);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -70,7 +70,7 @@ int emsi_remote_opts;
|
||||
char *emsi_local_password = NULL;
|
||||
char *emsi_remote_password = NULL;
|
||||
char emsi_remote_comm[4]="8N1";
|
||||
|
||||
int emsi_akas = 0;
|
||||
|
||||
|
||||
int rx_emsi(char *data)
|
||||
@ -448,6 +448,10 @@ SM_STATE(checkdat)
|
||||
Syslog('+', "Got EMSI_DAT packet \"%s\" with bad crc: %04x/%04x", printable(databuf, 0), lcrc, rcrc);
|
||||
SM_PROCEED(sendnak);
|
||||
} if (scanemsidat(databuf + 12) == 0) {
|
||||
if (emsi_akas == 0) {
|
||||
Syslog('+', "All akas busy, abort");
|
||||
SM_ERROR;
|
||||
}
|
||||
SM_PROCEED(sendack);
|
||||
} else {
|
||||
Syslog('+', "Could not parse EMSI_DAT packet \"%s\"",databuf);
|
||||
|
@ -47,6 +47,7 @@
|
||||
|
||||
extern int Loaded;
|
||||
extern int mypid;
|
||||
extern int emsi_akas;
|
||||
|
||||
|
||||
|
||||
@ -375,24 +376,35 @@ int scanemsidat(char *buf)
|
||||
}
|
||||
}
|
||||
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f));
|
||||
(void)nodelock(tmpa->addr, mypid);
|
||||
tmp = &remote;
|
||||
while (*tmp) {
|
||||
if (nodelock((*tmp)->addr, mypid)) {
|
||||
Syslog('+', "address : %s is locked, removed from aka list",ascfnode((*tmp)->addr,0x1f));
|
||||
tmpa=*tmp;
|
||||
*tmp=(*tmp)->next;
|
||||
free(tmpa);
|
||||
} else {
|
||||
/*
|
||||
* With the loaded flag we prevent removing the noderecord
|
||||
* when the remote presents us an address we don't know about.
|
||||
*/
|
||||
emsi_akas++;
|
||||
Syslog('+', "address : %s",ascfnode((*tmp)->addr,0x1f));
|
||||
if (!Loaded) {
|
||||
if (noderecord(tmpa->addr))
|
||||
if (noderecord((*tmp)->addr))
|
||||
Loaded = TRUE;
|
||||
}
|
||||
tmp = &((*tmp)->next);
|
||||
}
|
||||
}
|
||||
|
||||
if (emsi_akas) { /* Only if any aka's left */
|
||||
history.aka.zone = remote->addr->zone;
|
||||
history.aka.net = remote->addr->net;
|
||||
history.aka.node = remote->addr->node;
|
||||
history.aka.point = remote->addr->point;
|
||||
sprintf(history.aka.domain, "%s", remote->addr->domain);
|
||||
}
|
||||
|
||||
if (emsi_remote_password)
|
||||
free(emsi_remote_password);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -126,14 +126,12 @@ SM_NAMES
|
||||
(char *)"send_req",
|
||||
(char *)"recv_req"
|
||||
SM_EDECL
|
||||
int c,rc;
|
||||
int c,rc, mailsent = FALSE, mailrcvd = FALSE;
|
||||
char *nonhold_mail;
|
||||
int mailsent = FALSE, mailrcvd = FALSE;
|
||||
|
||||
nonhold_mail = (char *)ALL_MAIL;
|
||||
tosend = create_filelist(remote,nonhold_mail,2);
|
||||
|
||||
Syslog('s', "txftsc SEND_MAIL");
|
||||
if ((rc = xmsndfiles(tosend)))
|
||||
return rc;
|
||||
mailsent = TRUE;
|
||||
@ -142,7 +140,6 @@ SM_START(wait_command)
|
||||
|
||||
SM_STATE(wait_command)
|
||||
|
||||
Syslog('s', "txftsc WAIT_COMMAND");
|
||||
c = GETCHAR(30);
|
||||
if (c == TIMEOUT) {
|
||||
Syslog('+', "timeout waiting for remote action, try receive");
|
||||
@ -180,7 +177,6 @@ SM_STATE(wait_command)
|
||||
|
||||
SM_STATE(recv_mail)
|
||||
|
||||
Syslog('s', "txftsc RECV_MAIL");
|
||||
if (recvfiles()) {
|
||||
SM_ERROR;
|
||||
} else {
|
||||
@ -190,7 +186,6 @@ SM_STATE(recv_mail)
|
||||
|
||||
SM_STATE(send_req)
|
||||
|
||||
Syslog('s', "txftsc SEND_BARK");
|
||||
if (sendbark()) {
|
||||
SM_ERROR;
|
||||
} else {
|
||||
@ -199,7 +194,6 @@ SM_STATE(send_req)
|
||||
|
||||
SM_STATE(recv_req)
|
||||
|
||||
Syslog('s', "txftsc RECV_BARK");
|
||||
if (recvbark()) {
|
||||
SM_ERROR;
|
||||
} else {
|
||||
@ -223,15 +217,13 @@ SM_NAMES
|
||||
(char *)"send_req",
|
||||
(char *)"recv_req"
|
||||
SM_EDECL
|
||||
int c, count = 0, didwazoo = FALSE;
|
||||
int sentmail = FALSE, rcvdmail = FALSE;
|
||||
int c, count = 0, didwazoo = FALSE, sentmail = FALSE, rcvdmail = FALSE;
|
||||
file_list *request = NULL, *tmpfl;
|
||||
|
||||
SM_START(recv_mail)
|
||||
|
||||
SM_STATE(recv_mail)
|
||||
|
||||
Syslog('s', "rxftsc RECV_MAIL");
|
||||
if (recvfiles()) {
|
||||
SM_ERROR;
|
||||
} else {
|
||||
@ -241,7 +233,7 @@ SM_STATE(recv_mail)
|
||||
|
||||
SM_STATE(send_mail)
|
||||
|
||||
Syslog('s', "rxftsc SEND_MAIL count=%d", count);
|
||||
Syslog('x', "rxftsc SEND_MAIL count=%d", count);
|
||||
if (count++ > 45) {
|
||||
SM_ERROR;
|
||||
}
|
||||
@ -297,7 +289,7 @@ SM_STATE(send_mail)
|
||||
|
||||
SM_STATE(send_req)
|
||||
|
||||
Syslog('s', "rxftsc SEND_REQ count=%d", count);
|
||||
Syslog('x', "rxftsc SEND_REQ count=%d", count);
|
||||
|
||||
if (didwazoo) {
|
||||
SM_SUCCESS;
|
||||
@ -344,7 +336,6 @@ SM_STATE(send_req)
|
||||
|
||||
SM_STATE(recv_req)
|
||||
|
||||
Syslog('s', "rxftsc RECV_REQ");
|
||||
if (recvbark()) {
|
||||
if (sentmail && rcvdmail) {
|
||||
Syslog('+', "Consider session OK");
|
||||
@ -420,8 +411,18 @@ SM_STATE(scan_packet)
|
||||
free(fpath);
|
||||
SM_ERROR;
|
||||
case 0:
|
||||
case 5: Syslog('+', "accepting session");
|
||||
fclose(fp);
|
||||
case 5: fclose(fp);
|
||||
if (nodelock(&f, mypid)) {
|
||||
/*
|
||||
* Lock failed, FTSC-0001 allowes only one aka, so abort session.
|
||||
*/
|
||||
Syslog('+', "address : %s is locked, abort", ascfnode(&f, 0x1f));
|
||||
Syslog('s', "Unlink %s rc=%d", fpath, unlink(fpath));
|
||||
free(fpath);
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
Syslog('+', "accepting session");
|
||||
for (tmpl = &remote; *tmpl; tmpl = &((*tmpl)->next));
|
||||
(*tmpl)=(fa_list*)malloc(sizeof(fa_list));
|
||||
(*tmpl)->next=NULL;
|
||||
@ -432,10 +433,13 @@ SM_STATE(scan_packet)
|
||||
(*tmpl)->addr->point=f.point;
|
||||
(*tmpl)->addr->name=NULL;
|
||||
(*tmpl)->addr->domain=NULL;
|
||||
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) {
|
||||
(void)nodelock((*tmpl)->addr, mypid);
|
||||
/* try lock all remotes, ignore locking result */
|
||||
if (!Loaded)
|
||||
Syslog('+', "address : %s",ascfnode((*tmpl)->addr,0x1f));
|
||||
|
||||
/*
|
||||
* With the loaded flag we prevent removing the noderecord
|
||||
* when the remote presents us an address we don't know about.
|
||||
*/
|
||||
if (!Loaded) {
|
||||
if (noderecord((*tmpl)->addr))
|
||||
Loaded = TRUE;
|
||||
}
|
||||
|
@ -126,8 +126,8 @@ void die(int onsig)
|
||||
}
|
||||
|
||||
if (sentbytes || rcvdbytes) {
|
||||
total = (int)(c_end - c_start);
|
||||
if (!total)
|
||||
total = (int)(c_end - c_start -2);
|
||||
if (total < 1)
|
||||
total = 1;
|
||||
Syslog('+', "Sent %lu bytes, received %lu bytes, avg %d cps", sentbytes, rcvdbytes, (sentbytes + rcvdbytes) / total);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ int proc(void)\
|
||||
|
||||
#define SM_START(x) \
|
||||
sm_state=x;\
|
||||
Syslog('S', "SM (%s): Start => %s", sm_name, sm_sname[sm_state]); \
|
||||
Syslog('s', "SM (%s): Start => %s", sm_name, sm_sname[sm_state]); \
|
||||
while (!sm_success) switch (sm_state)\
|
||||
{\
|
||||
default: WriteError("Statemachine %s error: state=%d",sm_name,sm_state);\
|
||||
@ -38,16 +38,16 @@ int proc(void)\
|
||||
|
||||
#define SM_PROCEED(x) \
|
||||
if (x != sm_state) {\
|
||||
Syslog('S', "SM (%s): %s => %s", sm_name, sm_sname[sm_state], sm_sname[x]);\
|
||||
Syslog('s', "SM (%s): %s => %s", sm_name, sm_sname[sm_state], sm_sname[x]);\
|
||||
}\
|
||||
sm_state=x; break;
|
||||
|
||||
#define SM_SUCCESS \
|
||||
Syslog('S', "SM (%s): %s => Success", sm_name, sm_sname[sm_state]);\
|
||||
Syslog('s', "SM (%s): %s => Success", sm_name, sm_sname[sm_state]);\
|
||||
sm_success=1; break;
|
||||
|
||||
#define SM_ERROR \
|
||||
Syslog('S', "SM (%s): %s => Error", sm_name, sm_sname[sm_state]);\
|
||||
Syslog('s', "SM (%s): %s => Error", sm_name, sm_sname[sm_state]);\
|
||||
sm_success=-1; break;
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,9 @@ static int txyoohoo(void);
|
||||
static void fillhello(unsigned short,char*);
|
||||
static int checkhello(void);
|
||||
|
||||
static int y_akas;
|
||||
static int iscaller;
|
||||
|
||||
static struct _hello {
|
||||
unsigned char data[128];
|
||||
unsigned char crc[2];
|
||||
@ -129,6 +131,7 @@ int rx_yoohoo(void)
|
||||
char *pwd = NULL;
|
||||
|
||||
pwd = NULL;
|
||||
y_akas = 0;
|
||||
localcaps = LOCALCAPS;
|
||||
if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER);
|
||||
if (localoptions & NOZEDZAP) localcaps &= ~ZED_ZAPPER;
|
||||
@ -139,6 +142,12 @@ int rx_yoohoo(void)
|
||||
|
||||
if ((rc = rxyoohoo()) == 0) {
|
||||
Loaded = checkhello();
|
||||
|
||||
if (y_akas == 0) {
|
||||
Syslog('+', "All akas busy, abort");
|
||||
return MBERR_SESSION_ERROR;
|
||||
}
|
||||
|
||||
capabilities = hello2.capabilities;
|
||||
if (capabilities & WZ_FREQ)
|
||||
session_flags |= SESSION_WAZOO;
|
||||
@ -226,6 +235,7 @@ int tx_yoohoo(void)
|
||||
unsigned short capabilities;
|
||||
char *pwd;
|
||||
|
||||
y_akas = 0;
|
||||
if (strlen(nodes.Spasswd))
|
||||
pwd = xstrcpy(nodes.Spasswd);
|
||||
else
|
||||
@ -256,6 +266,10 @@ int tx_yoohoo(void)
|
||||
session_flags &= ~SESSION_WAZOO;
|
||||
}
|
||||
|
||||
if (y_akas == 0) {
|
||||
Syslog('+', "All akas busy, abort");
|
||||
return MBERR_SESSION_ERROR;
|
||||
}
|
||||
if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) {
|
||||
Syslog('+', "No common protocols");
|
||||
return MBERR_SESSION_ERROR;
|
||||
@ -299,17 +313,15 @@ SM_NAMES
|
||||
(char *)"sendack"
|
||||
SM_EDECL
|
||||
|
||||
int c;
|
||||
int count=0;
|
||||
int c, count=0;
|
||||
unsigned short lcrc, rcrc;
|
||||
|
||||
SM_START(sendenq)
|
||||
|
||||
SM_STATE(sendenq)
|
||||
|
||||
Syslog('S', "rxyoohoo SENDENQ");
|
||||
if (count++ > 12) {
|
||||
Syslog('+', "Too many tries to get hello packet");
|
||||
Syslog('+', "Too many tries to get YooHoo hello packet");
|
||||
SM_ERROR;
|
||||
}
|
||||
PUTCHAR(ENQ);
|
||||
@ -317,7 +329,6 @@ SM_STATE(sendenq)
|
||||
|
||||
SM_STATE(waitchar)
|
||||
|
||||
Syslog('S', "rxyoohoo WAITCHAR");
|
||||
c=GETCHAR(10);
|
||||
if (c == TIMEOUT) {
|
||||
SM_PROCEED(sendenq);
|
||||
@ -334,7 +345,6 @@ SM_STATE(waitchar)
|
||||
|
||||
SM_STATE(getpacket)
|
||||
|
||||
Syslog('S', "rxyoohoo GETPACKET");
|
||||
GET((char*)&hello, sizeof(hello), 30);
|
||||
if (STATUS) {
|
||||
SM_ERROR;
|
||||
@ -343,7 +353,7 @@ SM_STATE(getpacket)
|
||||
lcrc = crc16xmodem((char*)hello.data, sizeof(hello.data));
|
||||
rcrc = (hello.crc[0] << 8) + hello.crc[1];
|
||||
if (lcrc != rcrc) {
|
||||
Syslog('+',"crc does not match in hello packet: %04xh/%04xh", rcrc,lcrc);
|
||||
Syslog('+',"crc does not match in YooHoo hello packet: %04xh/%04xh", rcrc,lcrc);
|
||||
SM_PROCEED(sendnak);
|
||||
} else {
|
||||
SM_PROCEED(sendack);
|
||||
@ -351,9 +361,8 @@ SM_STATE(getpacket)
|
||||
|
||||
SM_STATE(sendnak)
|
||||
|
||||
Syslog('S', "rxyoohoo SENDNAK");
|
||||
if (count++ > 9) {
|
||||
Syslog('+', "Too many tries to get hello packet");
|
||||
Syslog('+', "Too many tries to get YooHoo hello packet");
|
||||
SM_ERROR;
|
||||
}
|
||||
PUTCHAR('?');
|
||||
@ -361,7 +370,6 @@ SM_STATE(sendnak)
|
||||
|
||||
SM_STATE(sendack)
|
||||
|
||||
Syslog('S', "rxyoohoo SENDACK");
|
||||
PUTCHAR(ACK);
|
||||
SM_SUCCESS;
|
||||
|
||||
@ -383,9 +391,7 @@ SM_NAMES
|
||||
(char *)"waitchar"
|
||||
SM_EDECL
|
||||
|
||||
int c;
|
||||
int count=0;
|
||||
int startstate;
|
||||
int c, count = 0, startstate;
|
||||
unsigned short lcrc;
|
||||
|
||||
if (iscaller)
|
||||
@ -396,19 +402,16 @@ SM_EDECL
|
||||
lcrc = crc16xmodem((char*)hello.data, sizeof(hello.data));
|
||||
hello.crc[0] = lcrc >> 8;
|
||||
hello.crc[1] = lcrc & 0xff;
|
||||
Syslog('S', "txyoohoo INIT");
|
||||
|
||||
SM_START(startstate)
|
||||
|
||||
SM_STATE(sendyoohoo)
|
||||
|
||||
Syslog('S', "txyoohoo SENDYOOHOO");
|
||||
PUTCHAR(YOOHOO);
|
||||
SM_PROCEED(waitenq);
|
||||
|
||||
SM_STATE(waitenq)
|
||||
|
||||
Syslog('S', "txyoohoo WAITENQ");
|
||||
c=GETCHAR(10);
|
||||
if (c == TIMEOUT) {
|
||||
if (count++ > 9) {
|
||||
@ -429,9 +432,8 @@ SM_STATE(waitenq)
|
||||
|
||||
SM_STATE(sendpkt)
|
||||
|
||||
Syslog('S', "txyoohoo SENDPKT");
|
||||
if (count++ > 9) {
|
||||
Syslog('+', "Too many tries to send hello packet");
|
||||
Syslog('+', "Too many tries to send YooHoo hello packet");
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
@ -444,7 +446,6 @@ SM_STATE(sendpkt)
|
||||
|
||||
SM_STATE(waitchar)
|
||||
|
||||
Syslog('S', "txyoohoo WAITCHAR");
|
||||
c=GETCHAR(30);
|
||||
if (c == TIMEOUT) {
|
||||
Syslog('+', "Timeout waiting hello ACK");
|
||||
@ -452,8 +453,7 @@ SM_STATE(waitchar)
|
||||
} else if (c < 0) {
|
||||
SM_ERROR;
|
||||
} else switch (c) {
|
||||
case ACK: Syslog('S', "Handshake successfull");
|
||||
SM_SUCCESS;
|
||||
case ACK: SM_SUCCESS;
|
||||
break;
|
||||
case '?': SM_PROCEED(sendpkt);
|
||||
break;
|
||||
@ -468,18 +468,15 @@ SM_RETURN
|
||||
|
||||
|
||||
|
||||
|
||||
void fillhello(unsigned short capabilities, char *password)
|
||||
{
|
||||
faddr *best;
|
||||
unsigned short majver, minver;
|
||||
|
||||
Syslog('S',"fillhello(0x%04hx)",capabilities);
|
||||
|
||||
best = bestaka_s(remote->addr);
|
||||
|
||||
sscanf(VERSION,"%hd.%hd", &majver, &minver);
|
||||
memset(&hello, 0, sizeof(hello));
|
||||
|
||||
hello.data[0] = 'o'; /* signal */
|
||||
hello.data[2] = 1; /* hello-version */
|
||||
hello.data[4] = (PRODCODE & 0x00ff); /* product code */
|
||||
@ -511,7 +508,6 @@ void fillhello(unsigned short capabilities, char *password)
|
||||
hello.data[114] = capabilities & 0xff; /* capabilities */
|
||||
hello.data[115] = capabilities >> 8; /* capabilities */
|
||||
tidy_faddr(best);
|
||||
Syslog('S',"filled hello \"%s\"",printable((char*)hello.data,128));
|
||||
}
|
||||
|
||||
|
||||
@ -519,22 +515,20 @@ void fillhello(unsigned short capabilities, char *password)
|
||||
int checkhello(void)
|
||||
{
|
||||
unsigned short i, majver = 0, minver = 0;
|
||||
fa_list **tmpl,*tmpn;
|
||||
fa_list **tmpl, *tmpa;
|
||||
faddr remaddr;
|
||||
char *prodnm, *q;
|
||||
int loaded = FALSE;
|
||||
|
||||
Syslog('S',"check hello \"%s\"",printable((char*)hello.data,128));
|
||||
|
||||
Syslog('s',"check hello \"%s\"",printable((char*)hello.data,128));
|
||||
hello2 = gethello2(hello.data);
|
||||
|
||||
if ((hello2.signal != 0x6f) ||
|
||||
(hello2.hello_version != 0x01)) {
|
||||
if ((hello2.signal != 0x6f) || (hello2.hello_version != 0x01)) {
|
||||
Syslog('+', "Got \"%s\" instead of \"o\\000\\001\000\"", printable((char*)hello.data,3));
|
||||
}
|
||||
|
||||
prodnm = xstrcpy((char *)"<unknown program>");
|
||||
for (i = 0; ftscprod[i].name; i++)
|
||||
for (i = 0; ftscprod[i].name; i++) {
|
||||
if (ftscprod[i].code == hello2.product) {
|
||||
free(prodnm);
|
||||
prodnm = xstrcpy(ftscprod[i].name);
|
||||
@ -542,6 +536,7 @@ int checkhello(void)
|
||||
minver = hello2.product_min;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
remaddr.zone = hello2.my_zone;
|
||||
remaddr.net = hello2.my_net;
|
||||
@ -558,7 +553,7 @@ int checkhello(void)
|
||||
remaddr.domain = NULL;
|
||||
}
|
||||
if (remote)
|
||||
Syslog('S',"Remote known address: %s",ascfnode(remote->addr,0x1f));
|
||||
Syslog('s',"Remote known address: %s",ascfnode(remote->addr,0x1f));
|
||||
|
||||
for (tmpl = &remote; *tmpl; tmpl = &((*tmpl)->next));
|
||||
if ((remote == NULL) || (metric(remote->addr, &remaddr) != 0)) {
|
||||
@ -573,25 +568,39 @@ int checkhello(void)
|
||||
(*tmpl)->addr->name = NULL; /* Added 15-Dec-1998 */
|
||||
} else {
|
||||
tmpl=&remote;
|
||||
Syslog('S',"Using single remote address");
|
||||
Syslog('s',"Using single remote address");
|
||||
}
|
||||
|
||||
for (tmpn = remote; tmpn; tmpn = tmpn->next) {
|
||||
(void)nodelock(tmpn->addr, mypid);
|
||||
tmpl = &remote;
|
||||
while (*tmpl) {
|
||||
if (nodelock((*tmpl)->addr, mypid)) {
|
||||
Syslog('+', " address: %s is locked, removed from aka list",ascfnode((*tmpl)->addr,0x1f));
|
||||
tmpa = *tmpl;
|
||||
*tmpl = (*tmpl)->next;
|
||||
tidy_faddr(tmpa->addr);
|
||||
free(tmpa);
|
||||
} else {
|
||||
Syslog('+', " address: %s",ascfnode((*tmpl)->addr,0x1f));
|
||||
y_akas++;
|
||||
/*
|
||||
* lock all remotes, ignore locking result
|
||||
* With the loaded flag we prevent removing the noderecord
|
||||
* when the remote presents us an address we don't know about.
|
||||
*/
|
||||
if (!loaded)
|
||||
if (noderecord(tmpn->addr))
|
||||
loaded = TRUE;
|
||||
if (!Loaded) {
|
||||
if (noderecord((*tmpl)->addr))
|
||||
Loaded = TRUE;
|
||||
}
|
||||
tmpl = &((*tmpl)->next);
|
||||
}
|
||||
}
|
||||
|
||||
Syslog('+', " address: %s",ascfnode(remote->addr,0x1f));
|
||||
if (y_akas) { /* Only set if we have aka's left */
|
||||
history.aka.zone = remote->addr->zone;
|
||||
history.aka.net = remote->addr->net;
|
||||
history.aka.node = remote->addr->node;
|
||||
history.aka.point = remote->addr->point;
|
||||
Syslog('S', "password: %s",(char*)hello2.my_password);
|
||||
}
|
||||
|
||||
if (hello2.product < 0x0100)
|
||||
Syslog('+', " uses: %s [%02X] version %d.%d", prodnm, hello2.product, majver, minver);
|
||||
else
|
||||
|
@ -89,7 +89,7 @@ static int alias_db_init(void)
|
||||
while (fcntl(fileno(afp), F_SETLK, &txflock) != 0) {
|
||||
if (tries > 4)
|
||||
Syslog('+', "Alias database locked %d errno=%d %s", tries +1, errno, strerror(errno));
|
||||
usleep(250000);
|
||||
msleep(250);
|
||||
if (++tries >= 60) {
|
||||
fclose(afp);
|
||||
afp = NULL;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Announce new files and FileFind
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -127,7 +127,7 @@ void Uploads()
|
||||
i++;
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if ((area.Available) && strlen(area.NewGroup)) {
|
||||
|
||||
@ -321,7 +321,7 @@ long Report(gr_list *ta, long filepos)
|
||||
if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group))) {
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
/*
|
||||
* Report one newfile, first line.
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Announce new files and FileFind
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -117,7 +117,7 @@ void ScanArea(ff_list **ffl)
|
||||
}
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (Msg_ReadHeader(Number) == TRUE) {
|
||||
if (((!strcasecmp(Msg.To, "allfix")) || (!strcasecmp(Msg.To, "filefind"))) && (!Msg.Received)) {
|
||||
@ -288,7 +288,7 @@ void ScanFiles(ff_list *tmp)
|
||||
Nopper();
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (!do_quiet) {
|
||||
printf("%6lu / %6lu", areanr, found);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose: File Database Maintenance - Build index for request processor
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -478,7 +478,7 @@ void ReqIndex(void)
|
||||
*/
|
||||
x++;
|
||||
if (CFG.slow_util && do_quiet && ((x % 3) == 0))
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
for (z = 0; z <= 25; z++) {
|
||||
if (strlen(file.Desc[z])) {
|
||||
@ -658,7 +658,7 @@ void HtmlIndex(char *Lang)
|
||||
TotalHtml++;
|
||||
aTotal++;
|
||||
if (CFG.slow_util && do_quiet && ((x % 3) == 0))
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
MacroVars("efghijklm", "ddsssssds", 0, 0, "", "", "", "", "", 0, "");
|
||||
MacroVars("e", "d", aTotal);
|
||||
|
@ -152,7 +152,7 @@ void Marker(void)
|
||||
* Release system resources when running in the background
|
||||
*/
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (do_quiet)
|
||||
return;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Nodelist Compiler
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -374,10 +374,10 @@ int compile(char *nlname, unsigned short zo, unsigned short ne, unsigned short n
|
||||
|
||||
if (CFG.slow_util && do_quiet) {
|
||||
if (zo) {
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
} else {
|
||||
if ((lineno % 40) == 0)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Message Base Maintenance
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -475,7 +475,7 @@ void KillArea(char *Path, char *Name, int DaysOld, int MaxMsgs, long Areanr)
|
||||
|
||||
do {
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if ((!do_quiet) && ((Counter % 10L) == 0)) {
|
||||
printf("%6lu / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", Counter, TotalMsgs);
|
||||
@ -587,7 +587,7 @@ void PackArea(char *Path, long Areanr)
|
||||
}
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: AreaMgr and FileMgr utilities.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -589,7 +589,7 @@ int Areas(void)
|
||||
for (tmp = alist; tmp; tmp = tmp->next) {
|
||||
fseek(fp, msgshdr.hdrsize, SEEK_SET);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
|
||||
if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name))
|
||||
tmp->IsPresent = TRUE;
|
||||
@ -639,7 +639,7 @@ int Areas(void)
|
||||
}
|
||||
cmd = xstrcat(cmd, tmp->Name);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +658,7 @@ int Areas(void)
|
||||
fseek(fp, msgshdr.hdrsize, SEEK_SET);
|
||||
Syslog('m', "Delete %s", tmp->Name);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
|
||||
if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) {
|
||||
fseek(fp, - msgshdr.recsize, SEEK_CUR);
|
||||
@ -828,7 +828,7 @@ int Areas(void)
|
||||
for (tmp = alist; tmp; tmp = tmp->next) {
|
||||
fseek(fp, tichdr.hdrsize, SEEK_SET);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
while (fread(&tic, tichdr.recsize, 1, fp) == 1) {
|
||||
if (tic.Active && !strcmp(tic.Group, fgroup.Name) && !strcmp(tic.Name, tmp->Name))
|
||||
tmp->IsPresent = TRUE;
|
||||
@ -886,7 +886,7 @@ int Areas(void)
|
||||
}
|
||||
cmd = xstrcat(cmd, tmp->Name);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -907,7 +907,7 @@ int Areas(void)
|
||||
fseek(fp, tichdr.hdrsize, SEEK_SET);
|
||||
Syslog('f', "Delete %s", tmp->Name);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
while (fread(&tic, tichdr.recsize, 1, fp) == 1) {
|
||||
if (tic.Active && !strcmp(tic.Group, fgroup.Name) && !strcmp(tic.Name, tmp->Name)) {
|
||||
fseek(fp, - tichdr.recsize, SEEK_CUR);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Statistic rollover util.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -65,7 +65,7 @@ void RollWeek(statcnt *S)
|
||||
S->tweek = 0L;
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ void Rollover()
|
||||
nodes.MailSent.month[Miy] = 0;
|
||||
nodes.MailRcvd.month[Miy] = 0;
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
fseek(fp, - nodeshdr.recsize, SEEK_CUR);
|
||||
fwrite(&nodes, nodeshdr.recsize, 1, fp);
|
||||
@ -199,7 +199,7 @@ void Rollover()
|
||||
msgs.Received.month[Miy] = 0;
|
||||
msgs.Posted.month[Miy] = 0;
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
fseek(fp, - msgshdr.recsize, SEEK_CUR);
|
||||
fwrite(&msgs, msgshdr.recsize, 1, fp);
|
||||
@ -239,7 +239,7 @@ void Rollover()
|
||||
mgroup.MsgsRcvd.month[Miy] = 0;
|
||||
mgroup.MsgsSent.month[Miy] = 0;
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
fseek(fp, - mgrouphdr.recsize, SEEK_CUR);
|
||||
fwrite(&mgroup, mgrouphdr.recsize, 1, fp);
|
||||
@ -278,7 +278,7 @@ void Rollover()
|
||||
tic.Files.month[Miy] = 0;
|
||||
tic.KBytes.month[Miy] = 0;
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
fseek(fp, - tichdr.recsize, SEEK_CUR);
|
||||
fwrite(&tic, tichdr.recsize, 1, fp);
|
||||
@ -318,7 +318,7 @@ void Rollover()
|
||||
fgroup.Files.month[Miy] = 0;
|
||||
fgroup.KBytes.month[Miy] = 0;
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
fseek(fp, - fgrouphdr.recsize, SEEK_CUR);
|
||||
fwrite(&fgroup, fgrouphdr.recsize, 1, fp);
|
||||
@ -354,7 +354,7 @@ void Rollover()
|
||||
if (do_month) {
|
||||
hatch.Hatched.month[Miy] = 0;
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
fseek(fp, - hatchhdr.recsize, SEEK_CUR);
|
||||
fwrite(&hatch, hatchhdr.recsize, 1, fp);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Scan for outgoing mail.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -182,7 +182,7 @@ void ScanFull()
|
||||
|
||||
do {
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (((Number % 10) == 0) && (!do_quiet)) {
|
||||
printf("%6lu\b\b\b\b\b\b", Number);
|
||||
@ -245,7 +245,7 @@ void ScanFull()
|
||||
|
||||
do {
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (((Number % 10) == 0) && (!do_quiet)) {
|
||||
printf("%6lu\b\b\b\b\b\b", Number);
|
||||
|
@ -464,7 +464,7 @@ int get_xover(char *grpname, long startnr, long endnr, List **art)
|
||||
fill_artlist(art, ptr, nr, dupe);
|
||||
free(p);
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Process .tic files
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -169,7 +169,7 @@ int LoadTic(char *inb, char *tfn)
|
||||
fa_list *sbl = NULL;
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
memset(&RealName, 0, sizeof(RealName));
|
||||
memset(&TIC, 0, sizeof(TIC));
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Toss a single *.pkt file
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -156,7 +156,7 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
|
||||
sysconnect Link;
|
||||
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
memset(&Link, 0, sizeof(Link));
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Common utilities
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -514,7 +514,7 @@ int Waitchar(unsigned char *ch, int wtime)
|
||||
rc = read(ttyfd, ch, 1);
|
||||
if (rc == 1)
|
||||
return rc;
|
||||
usleep(10000);
|
||||
msleep(10);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -862,6 +862,42 @@ void mvprintw(int y, int x, const char *format, ...)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* * Milliseconds timer, returns 0 on success.
|
||||
* */
|
||||
int msleep(int msecs)
|
||||
{
|
||||
int rc;
|
||||
struct timespec req, rem;
|
||||
|
||||
rem.tv_sec = 0;
|
||||
rem.tv_nsec = 0;
|
||||
req.tv_sec = msecs / 1000;
|
||||
req.tv_nsec = (msecs % 1000) * 1000000;
|
||||
|
||||
while (TRUE) {
|
||||
|
||||
rc = nanosleep(&req, &rem);
|
||||
if (rc == 0)
|
||||
break;
|
||||
if ((errno == EINVAL) || (errno == EFAULT)) {
|
||||
Syslog('?', "$msleep(%d)", msecs);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Error was EINTR, run timer again to complete.
|
||||
*/
|
||||
req.tv_sec = rem.tv_sec;
|
||||
req.tv_nsec = rem.tv_nsec;
|
||||
rem.tv_sec = 0;
|
||||
rem.tv_nsec = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Signal handler signal names.
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ void colour(int, int);
|
||||
void clear(void);
|
||||
void locate(int, int);
|
||||
void mvprintw(int, int, const char *, ...);
|
||||
|
||||
int msleep(int);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Utilities
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -531,9 +531,9 @@ void working(int txno, int y, int x)
|
||||
for (i = 1; i <= 5; i++) {
|
||||
putchar(7);
|
||||
fflush(stdout);
|
||||
usleep(150000);
|
||||
msleep(150);
|
||||
}
|
||||
usleep(550000);
|
||||
msleep(550);
|
||||
break;
|
||||
case 3: mvprintw(4, columns - 14, (char *)"Form inserted");
|
||||
putchar(7);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Creates allfiles listings
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -350,7 +350,7 @@ void Masterlist()
|
||||
*/
|
||||
x++;
|
||||
if (CFG.slow_util && do_quiet && ((x % 3) == 0))
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
AllFiles++;
|
||||
AllAreaFiles++;
|
||||
AllAreaBytes += file.Size;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Change BBS status
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -153,7 +153,6 @@ int main(int argc, char **argv)
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbstat", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
usleep(1);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBSTAT v%s", VERSION);
|
||||
@ -186,7 +185,6 @@ int main(int argc, char **argv)
|
||||
if (!(do_open || do_close || do_wait || do_sema))
|
||||
Help();
|
||||
|
||||
usleep(1);
|
||||
die(MBERR_OK);
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: User Pack Util
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -255,7 +255,7 @@ void UserPack(int days, int level, int pack)
|
||||
fwrite(&usr, sizeof(usr), 1, fout);
|
||||
memset(&usr, 0, sizeof(usr));
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
Nopper();
|
||||
}
|
||||
fclose(fin);
|
||||
@ -300,7 +300,7 @@ void UserPack(int days, int level, int pack)
|
||||
fwrite(&usr, sizeof(usr), 1, fout);
|
||||
}
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
Syslog('+', "Marked %d users to delete", delete);
|
||||
}
|
||||
@ -314,7 +314,7 @@ void UserPack(int days, int level, int pack)
|
||||
fseek(fout, sizeof(usrhdr), SEEK_SET);
|
||||
while (fread(&usr, sizeof(usr), 1, fout) == 1) {
|
||||
if (CFG.slow_util && do_quiet)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
Nopper();
|
||||
if (usr.Deleted) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Offline Reader
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -2693,7 +2693,7 @@ unsigned long QWK_PackArea(unsigned long ulLast, long Area)
|
||||
fwrite(&Qwk, sizeof(Qwk), 1, fdm);
|
||||
fseek(fdm, 0L, SEEK_END);
|
||||
if ((Total % 16L) == 0L)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
}
|
||||
|
||||
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
||||
@ -2937,7 +2937,7 @@ unsigned long ASCII_PackArea(unsigned long ulLast, long Area)
|
||||
}
|
||||
|
||||
if ((Total % 16L) == 0L)
|
||||
usleep(1);
|
||||
msleep(1);
|
||||
|
||||
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
||||
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Screen functions for setup.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -227,9 +227,9 @@ void working(int txno, int y, int x)
|
||||
for (i = 1; i <= 5; i++) {
|
||||
fputc(7, stdout);
|
||||
fflush(stdout);
|
||||
usleep(150000);
|
||||
msleep(150);
|
||||
}
|
||||
usleep(550000);
|
||||
msleep(550);
|
||||
break;
|
||||
case 3: mvprintw(4, 66, (char *)"Form inserted");
|
||||
fputc(7, stdout);
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
include ../Makefile.global
|
||||
|
||||
OTHER = Makefile README maint midnight weekly monthly installinit.sh rc rc.shutdown \
|
||||
mbse.start mbse.stop bbsdoor.sh rundoor.sh init.Debian init.RedHat \
|
||||
OTHER = Makefile README maint midnight weekly monthly installinit.sh setup.mbse \
|
||||
bbsdoor.sh rundoor.sh init.Debian init.RedHat init.FreeBSD init.NetBSD \
|
||||
init.Slackware init.SuSE init.Gentoo hatch editor.in bbsjoerc bbsjmacsrc
|
||||
|
||||
####################################################################################################
|
||||
|
Reference in New Issue
Block a user