Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Synchronet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
127
Issues
127
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main
Synchronet
Commits
73ebaaba
Commit
73ebaaba
authored
May 21, 2001
by
rswindell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed NODE.DAB locking failure delays (earlier and longer).
parent
f0a8f4d5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
317 additions
and
195 deletions
+317
-195
src/sbbs3/ftpsrvr.c
src/sbbs3/ftpsrvr.c
+2
-2
src/sbbs3/getnode.cpp
src/sbbs3/getnode.cpp
+45
-41
src/sbbs3/main.cpp
src/sbbs3/main.cpp
+18
-9
src/sbbs3/misc.c
src/sbbs3/misc.c
+2
-2
src/sbbs3/node.c
src/sbbs3/node.c
+172
-82
src/sbbs3/putnode.cpp
src/sbbs3/putnode.cpp
+21
-16
src/sbbs3/userdat.c
src/sbbs3/userdat.c
+33
-29
src/sbbs3/useredit.cpp
src/sbbs3/useredit.cpp
+24
-14
No files found.
src/sbbs3/ftpsrvr.c
View file @
73ebaaba
...
...
@@ -948,8 +948,8 @@ static int nopen(char *str, int access)
else
share
=
SH_DENYRW
;
while
(((
file
=
sopen
(
str
,
O_BINARY
|
access
,
share
))
==-
1
)
&&
errno
==
EACCES
&&
count
++<
LOOP_NOPEN
)
if
(
count
>
10
)
mswait
(
55
);
if
(
count
)
mswait
(
100
);
return
(
file
);
}
...
...
src/sbbs3/getnode.cpp
View file @
73ebaaba
...
...
@@ -45,12 +45,13 @@
/****************************************************************************/
void
sbbs_t
::
getnodedat
(
uint
number
,
node_t
*
node
,
bool
lockit
)
{
char
str
[
256
];
int
count
=
0
;
char
str
[
MAX_PATH
];
int
count
;
if
(
!
number
||
number
>
cfg
.
sys_nodes
)
{
errormsg
(
WHERE
,
ERR_CHK
,
"node number"
,
number
);
return
;
}
return
;
}
if
(
nodefile
==-
1
)
{
sprintf
(
str
,
"%snode.dab"
,
cfg
.
ctrl_dir
);
...
...
@@ -62,17 +63,16 @@ void sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
}
number
--
;
/* make zero based */
while
(
count
<
LOOP_NODEDAB
)
{
if
(
count
>
10
)
for
(
count
=
0
;
count
<
LOOP_NODEDAB
;
count
++
)
{
if
(
count
)
mswait
(
100
);
lseek
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
SEEK_SET
);
if
(
lockit
&&
lock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
))
==-
1
)
{
count
++
;
continue
;
}
&&
lock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
))
!=
0
)
{
continue
;
}
lseek
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
SEEK_SET
);
if
(
read
(
nodefile
,
node
,
sizeof
(
node_t
))
==
sizeof
(
node_t
))
break
;
count
++
;
}
if
(
!
lockit
)
{
close
(
nodefile
);
...
...
@@ -81,11 +81,10 @@ void sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
if
(
count
>
(
LOOP_NODEDAB
/
2
)
&&
count
!=
LOOP_NODEDAB
)
{
sprintf
(
str
,
"NODE.DAB COLLISION - Count: %d"
,
count
);
logline
(
"!!"
,
str
);
}
if
(
count
==
LOOP_NODEDAB
)
{
errormsg
(
WHERE
,
ERR_READ
,
"node.dab"
,
number
+
1
);
return
;
logline
(
"!!"
,
str
);
}
else
if
(
count
==
LOOP_NODEDAB
)
errormsg
(
WHERE
,
ERR_READ
,
"node.dab"
,
number
+
1
);
}
/****************************************************************************/
...
...
@@ -99,7 +98,8 @@ void sbbs_t::nodesync()
char
str
[
256
],
today
[
32
];
int
atr
=
curatr
;
/* was lclatr(-1) 01/29/96 */
if
(
nodesync_inside
)
return
;
if
(
nodesync_inside
)
return
;
nodesync_inside
=
1
;
if
(
thisnode
.
action
!=
action
)
{
...
...
@@ -171,9 +171,9 @@ void sbbs_t::nodesync()
/****************************************************************************/
void
sbbs_t
::
getnmsg
()
{
char
str
[
256
],
HUGE16
*
buf
;
int
file
;
long
length
;
char
str
[
MAX_PATH
],
HUGE16
*
buf
;
int
file
;
long
length
;
getnodedat
(
cfg
.
node_num
,
&
thisnode
,
1
);
thisnode
.
misc
&=~
NODE_NMSG
;
/* clear the NMSG flag */
...
...
@@ -186,7 +186,8 @@ void sbbs_t::getnmsg()
/**
errormsg(WHERE,ERR_OPEN,str,O_RDWR);
**/
return
;
}
return
;
}
length
=
filelength
(
file
);
if
(
!
length
)
{
close
(
file
);
...
...
@@ -216,12 +217,13 @@ void sbbs_t::getnmsg()
/****************************************************************************/
void
sbbs_t
::
getnodeext
(
uint
number
,
char
*
ext
)
{
char
str
[
256
];
int
count
=
0
;
char
str
[
MAX_PATH
];
int
count
;
if
(
!
number
||
number
>
cfg
.
sys_nodes
)
{
errormsg
(
WHERE
,
ERR_CHK
,
"node number"
,
number
);
return
;
}
return
;
}
sprintf
(
str
,
"%snode.exb"
,
cfg
.
ctrl_dir
);
if
((
node_ext
=
nopen
(
str
,
O_RDONLY
|
O_DENYNONE
))
==-
1
)
{
...
...
@@ -231,16 +233,15 @@ void sbbs_t::getnodeext(uint number, char *ext)
}
number
--
;
/* make zero based */
while
(
count
<
LOOP_NODEDAB
)
{
if
(
count
>
10
)
for
(
count
=
0
;
count
<
LOOP_NODEDAB
;
count
++
)
{
if
(
count
)
mswait
(
100
);
if
(
lock
(
node_ext
,(
long
)
number
*
128L
,
128
)
==-
1
)
{
count
++
;
continue
;
}
if
(
lock
(
node_ext
,(
long
)
number
*
128L
,
128
)
==-
1
)
continue
;
lseek
(
node_ext
,(
long
)
number
*
128L
,
SEEK_SET
);
if
(
read
(
node_ext
,
ext
,
128
)
==
128
)
break
;
count
++
;
}
}
unlock
(
node_ext
,(
long
)
number
*
128L
,
128
);
close
(
node_ext
);
node_ext
=-
1
;
...
...
@@ -249,10 +250,8 @@ void sbbs_t::getnodeext(uint number, char *ext)
sprintf
(
str
,
"NODE.EXB COLLISION - Count: %d"
,
count
);
logline
(
"!!"
,
str
);
}
if
(
count
==
LOOP_NODEDAB
)
{
else
if
(
count
==
LOOP_NODEDAB
)
errormsg
(
WHERE
,
ERR_READ
,
"node.exb"
,
number
+
1
);
return
;
}
}
...
...
@@ -262,9 +261,9 @@ void sbbs_t::getnodeext(uint number, char *ext)
/****************************************************************************/
void
sbbs_t
::
getsmsg
(
int
usernumber
)
{
char
str
[
256
],
HUGE16
*
buf
;
int
file
;
long
length
;
char
str
[
MAX_PATH
],
HUGE16
*
buf
;
int
file
;
long
length
;
sprintf
(
str
,
"%smsgs/%4.4u.msg"
,
cfg
.
data_dir
,
usernumber
);
if
(
flength
(
str
)
<
1L
)
...
...
@@ -304,8 +303,8 @@ void sbbs_t::getsmsg(int usernumber)
/****************************************************************************/
int
sbbs_t
::
whos_online
(
bool
listself
)
{
int
i
,
j
;
node_t
node
;
int
i
,
j
;
node_t
node
;
CRLF
;
bputs
(
text
[
NodeLstHdr
]);
...
...
@@ -509,8 +508,10 @@ void sbbs_t::printnodedat(uint number, node_t* node)
else
hour
=
node
->
aux
/
60
;
strcpy
(
mer
,
"am"
);
}
bprintf
(
" ETA %02d:%02d %s"
,
hour
,
node
->
aux
%
60
,
mer
);
}
break
;
}
,
hour
,
node
->
aux
%
60
,
mer
);
}
break
;
}
i
=
NODE_LOCK
;
if
(
node
->
status
==
NODE_INUSE
||
SYSOP
)
i
|=
NODE_POFF
|
NODE_AOFF
|
NODE_MSGW
|
NODE_NMSG
;
...
...
@@ -524,7 +525,8 @@ void sbbs_t::printnodedat(uint number, node_t* node)
outchar
(
'M'
);
if
(
node
->
misc
&
(
i
&
NODE_POFF
))
outchar
(
'P'
);
outchar
(
')'
);
}
outchar
(
')'
);
}
if
(
SYSOP
&&
((
node
->
misc
&
(
NODE_ANON
|
NODE_UDAT
|
NODE_INTR
|
NODE_RRUN
|
NODE_EVENT
|
NODE_DOWN
|
NODE_LCHAT
))
||
node
->
status
==
NODE_QUIET
))
{
...
...
@@ -545,10 +547,12 @@ void sbbs_t::printnodedat(uint number, node_t* node)
outchar
(
'D'
);
if
(
node
->
misc
&
NODE_LCHAT
)
outchar
(
'C'
);
outchar
(
']'
);
}
outchar
(
']'
);
}
if
(
node
->
errors
&&
SYSOP
)
{
attr
(
cfg
.
color
[
clr_err
]);
bprintf
(
" %d error%c"
,
node
->
errors
,
node
->
errors
>
1
?
's'
:
'\0'
);
}
bprintf
(
" %d error%c"
,
node
->
errors
,
node
->
errors
>
1
?
's'
:
'\0'
);
}
attr
(
LIGHTGRAY
);
CRLF
;
}
src/sbbs3/main.cpp
View file @
73ebaaba
...
...
@@ -634,6 +634,8 @@ void input_thread(void *arg)
if
(
ERROR_VALUE
==
ENOTSOCK
)
lprintf
(
"Node %d socket closed by peer on input->select"
,
sbbs
->
cfg
.
node_num
);
else
if
(
ERROR_VALUE
==
ESHUTDOWN
)
lprintf
(
"Node %d socket shutdown on input->select"
,
sbbs
->
cfg
.
node_num
);
else
if
(
ERROR_VALUE
==
EINTR
)
lprintf
(
"Node %d input thread interrupted"
,
sbbs
->
cfg
.
node_num
);
else
if
(
ERROR_VALUE
==
ECONNRESET
)
...
...
@@ -674,6 +676,8 @@ void input_thread(void *arg)
lprintf
(
"Node %d socket closed by peer on receive"
,
sbbs
->
cfg
.
node_num
);
else
if
(
ERROR_VALUE
==
ECONNRESET
)
lprintf
(
"Node %d connection reset by peer on receive"
,
sbbs
->
cfg
.
node_num
);
else
if
(
ERROR_VALUE
==
ESHUTDOWN
)
lprintf
(
"Node %d socket shutdown on receive"
,
sbbs
->
cfg
.
node_num
);
else
if
(
ERROR_VALUE
==
ECONNABORTED
)
lprintf
(
"Node %d connection aborted by peer on receive"
,
sbbs
->
cfg
.
node_num
);
else
...
...
@@ -1573,16 +1577,21 @@ bool sbbs_t::init()
lseek
(
nodefile
,
0L
,
SEEK_END
);
write
(
nodefile
,
&
node
,
sizeof
(
node_t
));
}
if
(
cfg
.
node_num
)
{
if
(
lock
(
nodefile
,(
cfg
.
node_num
-
1
)
*
sizeof
(
node_t
),
sizeof
(
node_t
))
||
unlock
(
nodefile
,(
cfg
.
node_num
-
1
)
*
sizeof
(
node_t
),
sizeof
(
node_t
)))
{
errormsg
(
WHERE
,
ERR_LOCK
,
str
,
cfg
.
node_num
);
return
(
false
);
for
(
i
=
0
;
cfg
.
node_num
&&
i
<
LOOP_NODEDAB
;
i
++
)
{
if
(
lock
(
nodefile
,(
cfg
.
node_num
-
1
)
*
sizeof
(
node_t
),
sizeof
(
node_t
))
==
0
)
{
unlock
(
nodefile
,(
cfg
.
node_num
-
1
)
*
sizeof
(
node_t
),
sizeof
(
node_t
));
break
;
}
mswait
(
100
);
}
close
(
nodefile
);
nodefile
=-
1
;
if
(
i
>=
LOOP_NODEDAB
)
{
errormsg
(
WHERE
,
ERR_LOCK
,
str
,
cfg
.
node_num
);
return
(
false
);
}
#if 0
sprintf(str,"%s%s",cfg.ctrl_dir,"node.exb");
if((node_ext_fp=fnopen(&node_ext,str,O_DENYNONE|O_RDWR|O_CREAT))==NULL) {
...
...
@@ -1964,7 +1973,7 @@ sbbs_t::~sbbs_t()
FREE_AND_NULL
(
batdn_cdt
);
FREE_AND_NULL
(
batdn_alt
);
#if defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER)
#if
0 &&
defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER)
if(!_CrtCheckMemory())
lprintf("!MEMORY ERRORS REPORTED IN DATA/DEBUG.LOG!");
#endif
...
...
@@ -1989,8 +1998,8 @@ int sbbs_t::nopen(char *str, int access)
else
share
=
SH_DENYRW
;
while
(((
file
=
sopen
(
str
,
O_BINARY
|
access
,
share
))
==-
1
)
&&
errno
==
EACCES
&&
count
++<
LOOP_NOPEN
)
if
(
count
>
10
)
mswait
(
55
);
if
(
count
)
mswait
(
100
);
if
(
count
>
(
LOOP_NOPEN
/
2
)
&&
count
<=
LOOP_NOPEN
)
{
sprintf
(
logstr
,
"NOPEN COLLISION - File: %s Count: %d"
,
str
,
count
);
...
...
@@ -2812,7 +2821,7 @@ static void cleanup(int code)
#ifdef _WIN32
CloseHandle
(
exec_mutex
);
#if defined(_DEBUG) && defined(_MSC_VER)
#if
0 &&
defined(_DEBUG) && defined(_MSC_VER)
_CrtMemDumpAllObjectsSince(&mem_chkpoint);
if(debug_log!=INVALID_HANDLE_VALUE) {
...
...
src/sbbs3/misc.c
View file @
73ebaaba
...
...
@@ -54,8 +54,8 @@ int nopen(char *str, int access)
else
share
=
SH_DENYRW
;
while
(((
file
=
sopen
(
str
,
O_BINARY
|
access
,
share
))
==-
1
)
&&
errno
==
EACCES
&&
count
++<
LOOP_NOPEN
)
if
(
count
>
10
)
mswait
(
55
);
if
(
count
)
mswait
(
100
);
return
(
file
);
}
/****************************************************************************/
...
...
src/sbbs3/node.c
View file @
73ebaaba
...
...
@@ -73,6 +73,60 @@ enum {
char
tmp
[
256
];
int
nodefile
;
#if defined(_WIN32)
/* Microsoft-supplied cls() routine - ugh! */
/* Standard error macro for reporting API errors */
#define PERR(bSuccess, api){if(!(bSuccess)) printf("%s:Error %d from %s \
on line %d\n", __FILE__, GetLastError(), api, __LINE__);}
void
cls
(
void
)
{
COORD
coordScreen
=
{
0
,
0
};
/* here's where we'll home the
cursor */
BOOL
bSuccess
;
DWORD
cCharsWritten
;
CONSOLE_SCREEN_BUFFER_INFO
csbi
;
/* to get buffer info */
DWORD
dwConSize
;
/* number of character cells in
the current buffer */
HANDLE
hConsole
;
hConsole
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
/* get the number of character cells in the current buffer */
bSuccess
=
GetConsoleScreenBufferInfo
(
hConsole
,
&
csbi
);
PERR
(
bSuccess
,
"GetConsoleScreenBufferInfo"
);
dwConSize
=
csbi
.
dwSize
.
X
*
csbi
.
dwSize
.
Y
;
/* fill the entire screen with blanks */
bSuccess
=
FillConsoleOutputCharacter
(
hConsole
,
(
TCHAR
)
' '
,
dwConSize
,
coordScreen
,
&
cCharsWritten
);
PERR
(
bSuccess
,
"FillConsoleOutputCharacter"
);
/* get the current text attribute */
bSuccess
=
GetConsoleScreenBufferInfo
(
hConsole
,
&
csbi
);
PERR
(
bSuccess
,
"ConsoleScreenBufferInfo"
);
/* now set the buffer's attributes accordingly */
bSuccess
=
FillConsoleOutputAttribute
(
hConsole
,
csbi
.
wAttributes
,
dwConSize
,
coordScreen
,
&
cCharsWritten
);
PERR
(
bSuccess
,
"FillConsoleOutputAttribute"
);
/* put the cursor at (0, 0) */
bSuccess
=
SetConsoleCursorPosition
(
hConsole
,
coordScreen
);
PERR
(
bSuccess
,
"SetConsoleCursorPosition"
);
return
;
}
#else
/* !_WIN32 */
#define cls()
#endif
#if !defined _MSC_VER && !defined __BORLANDC__
char
*
itoa
(
int
val
,
char
*
str
,
int
radix
)
{
...
...
@@ -94,6 +148,21 @@ char* itoa(int val, char* str, int radix)
}
#endif
#if defined(_WIN32)
#define mswait(x) Sleep(x)
#elif defined(__OS2__)
#define mswait(x) DosSleep(x)
#elif defined(__unix__)
#define mswait(x) usleep(x*1000)
#endif
/****************************************************************************/
/* Reads the data for node number 'number' into the structure 'node' */
/* from NODE.DAB */
...
...
@@ -101,23 +170,24 @@ char* itoa(int val, char* str, int radix)
/****************************************************************************/
void
getnodedat
(
uchar
number
,
node_t
*
node
,
char
lockit
)
{
int
count
=
0
;
int
count
;
number
--
;
/* make zero based */
while
(
count
<
LOOP_NODEDAB
)
{
for
(
count
=
0
;
count
<
LOOP_NODEDAB
;
count
++
)
{
if
(
count
)
mswait
(
100
);
lseek
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
SEEK_SET
);
if
(
lockit
&&
lock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
))
==-
1
)
{
count
++
;
continue
;
}
&&
lock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
))
==-
1
)
continue
;
if
(
read
(
nodefile
,
node
,
sizeof
(
node_t
))
==
sizeof
(
node_t
))
break
;
count
++
;
}
if
(
count
)
printf
(
"NODE.DAB COLLISION (READ) - Count:%d
\n
"
,
count
);
if
(
count
==
LOOP_NODEDAB
)
{
printf
(
"Error reading nodefile for node %d
\n
"
,
number
+
1
);
return
;
}
}
if
(
count
>=
(
LOOP_NODEDAB
/
2
)
)
printf
(
"NODE.DAB COLLISION (READ) - Count:
%d
\n
"
,
count
);
else
if
(
count
==
LOOP_NODEDAB
)
{
printf
(
"
!
Error reading nodefile for node %d
\n
"
,
number
+
1
);
}
}
/****************************************************************************/
...
...
@@ -357,6 +427,8 @@ int main(int argc, char **argv)
char
str
[
256
],
ctrl_dir
[
41
],
*
p
,
debug
=
0
;
int
sys_nodes
,
node_num
=
0
,
onoff
=
0
;
int
i
,
j
,
mode
=
0
,
misc
;
int
modify
=
0
;
int
loop
=
0
;
long
value
;
node_t
node
;
...
...
@@ -419,6 +491,9 @@ int main(int argc, char **argv)
node_num
=
onoff
=
value
=
0
;
if
(
!
stricmp
(
argv
[
i
],
"/DEBUG"
))
debug
=
1
;
if
(
!
stricmp
(
argv
[
i
],
"/LOOP"
))
loop
=
1
;
else
if
(
!
stricmp
(
argv
[
i
],
"LOCK"
))
mode
=
MODE_LOCK
;
else
if
(
!
stricmp
(
argv
[
i
],
"ANON"
))
...
...
@@ -464,78 +539,93 @@ int main(int argc, char **argv)
mode
=
MODE_EXTAUX
;
value
=
atoi
(
argv
[
i
]
+
7
);
}
}
if
(
mode
!=
MODE_LIST
)
modify
=
1
;
if
((
mode
&&
node_num
)
||
i
+
1
==
argc
)
for
(
j
=
1
;
j
<=
sys_nodes
;
j
++
)
if
(
!
node_num
||
j
==
node_num
)
{
getnodedat
(
j
,
&
node
,
1
);
misc
=
0
;
switch
(
mode
)
{
case
MODE_ANON
:
misc
=
NODE_ANON
;
break
;
case
MODE_LOCK
:
misc
=
NODE_LOCK
;
break
;
case
MODE_INTR
:
misc
=
NODE_INTR
;
break
;
case
MODE_DOWN
:
misc
=
NODE_DOWN
;
break
;
case
MODE_RRUN
:
misc
=
NODE_RRUN
;
break
;
case
MODE_EVENT
:
misc
=
NODE_EVENT
;
break
;
case
MODE_NOPAGE
:
misc
=
NODE_POFF
;
break
;
case
MODE_NOALERTS
:
misc
=
NODE_AOFF
;
break
;
case
MODE_STATUS
:
node
.
status
=
value
;
break
;
case
MODE_ERRORS
:
node
.
errors
=
value
;
break
;
case
MODE_ACTION
:
node
.
action
=
value
;
break
;
case
MODE_USERON
:
node
.
useron
=
value
;
break
;
case
MODE_MISC
:
node
.
misc
=
value
;
break
;
case
MODE_CONN
:
node
.
connection
=
value
;
break
;
case
MODE_AUX
:
node
.
aux
=
value
;
break
;
case
MODE_EXTAUX
:
node
.
extaux
=
value
;
break
;
}
if
(
misc
)
{
if
(
onoff
==
0
)
node
.
misc
^=
misc
;
else
if
(
onoff
==
1
)
node
.
misc
|=
misc
;
else
if
(
onoff
==
2
)
node
.
misc
&=~
misc
;
}
putnodedat
(
j
,
node
);
printnodedat
(
j
,
node
);
if
(
debug
)
{
printf
(
"status=%u
\n
"
,
node
.
status
);
printf
(
"errors=%u
\n
"
,
node
.
errors
);
printf
(
"action=%d
\n
"
,
node
.
action
);
printf
(
"useron=%u
\n
"
,
node
.
useron
);
printf
(
"conn=%u
\n
"
,
node
.
connection
);
printf
(
"misc=%u
\n
"
,
node
.
misc
);
printf
(
"aux=%u
\n
"
,
node
.
aux
);
printf
(
"extaux=%lu
\n
"
,
node
.
extaux
);
}
}
}
while
(
1
)
{
for
(
j
=
1
;
j
<=
sys_nodes
;
j
++
)
if
(
!
node_num
||
j
==
node_num
)
{
getnodedat
(
j
,
&
node
,
modify
);
misc
=
0
;
switch
(
mode
)
{
case
MODE_ANON
:
misc
=
NODE_ANON
;
break
;
case
MODE_LOCK
:
misc
=
NODE_LOCK
;
break
;
case
MODE_INTR
:
misc
=
NODE_INTR
;
break
;
case
MODE_DOWN
:
misc
=
NODE_DOWN
;
break
;
case
MODE_RRUN
:
misc
=
NODE_RRUN
;
break
;
case
MODE_EVENT
:
misc
=
NODE_EVENT
;
break
;
case
MODE_NOPAGE
:
misc
=
NODE_POFF
;
break
;
case
MODE_NOALERTS
:
misc
=
NODE_AOFF
;
break
;
case
MODE_STATUS
:
node
.
status
=
value
;
break
;
case
MODE_ERRORS
:
node
.
errors
=
value
;
break
;
case
MODE_ACTION
:
node
.
action
=
value
;
break
;
case
MODE_USERON
:
node
.
useron
=
value
;
break
;
case
MODE_MISC
:
node
.
misc
=
value
;
break
;
case
MODE_CONN
:
node
.
connection
=
value
;
break
;
case
MODE_AUX
:
node
.
aux
=
value
;
break
;
case
MODE_EXTAUX
:
node
.
extaux
=
value
;
break
;
}
if
(
misc
)
{
if
(
onoff
==
0
)
node
.
misc
^=
misc
;
else
if
(
onoff
==
1
)
node
.
misc
|=
misc
;
else
if
(
onoff
==
2
)
node
.
misc
&=~
misc
;
}
if
(
modify
)
putnodedat
(
j
,
node
);
printnodedat
(
j
,
node
);
if
(
debug
)
{
printf
(
"status=%u
\n
"
,
node
.
status
);
printf
(
"errors=%u
\n
"
,
node
.
errors
);
printf
(
"action=%d
\n
"
,
node
.
action
);
printf
(
"useron=%u
\n
"
,
node
.
useron
);
printf
(
"conn=%u
\n
"
,
node
.
connection
);
printf
(
"misc=%u
\n
"
,
node
.
misc
);
printf
(
"aux=%u
\n
"
,
node
.
aux
);
printf
(
"extaux=%lu
\n
"
,
node
.
extaux
);
}
/* debug */
}
/* if(!node_num) */
if
(
!
loop
)
break
;
mswait
(
1000
);
cls
();
}
/* while(1) */
}
/* for i<argc */
close
(
nodefile
);
return
(
0
);
...
...
src/sbbs3/putnode.cpp
View file @
73ebaaba
...
...
@@ -44,11 +44,14 @@
/****************************************************************************/
void
sbbs_t
::
putnodedat
(
uint
number
,
node_t
*
node
)
{
char
str
[
256
],
firston
[
25
];
char
str
[
256
],
firston
[
25
];
int
wr
;
int
wrerr
;
if
(
!
number
||
number
>
cfg
.
sys_nodes
)
{
errormsg
(
WHERE
,
ERR_CHK
,
"node number"
,
number
);
return
;
}
return
;
}
if
(
number
==
cfg
.
node_num
)
{
if
((
node
->
status
==
NODE_INUSE
||
node
->
status
==
NODE_QUIET
)
&&
node
->
action
<
NODE_LAST_ACTION
...
...
@@ -80,14 +83,17 @@ void sbbs_t::putnodedat(uint number, node_t* node)
number
--
;
/* make zero based */
lseek
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
SEEK_SET
);
if
(
write
(
nodefile
,
node
,
sizeof
(
node_t
))
!=
sizeof
(
node_t
))
{
unlock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
));
errormsg
(
WHERE
,
ERR_WRITE
,
"nodefile"
,
number
+
1
);
return
;
}
wr
=
write
(
nodefile
,
node
,
sizeof
(
node_t
));
wrerr
=
errno
;
/* save write error */
unlock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
));
close
(
nodefile
);
nodefile
=-
1
;
if
(
wr
!=
sizeof
(
node_t
))
{
unlock
(
nodefile
,(
long
)
number
*
sizeof
(
node_t
),
sizeof
(
node_t
));
errno
=
wrerr
;
errormsg
(
WHERE
,
ERR_WRITE
,
"nodefile"
,
number
+
1
);
}
}
/****************************************************************************/
...
...
@@ -120,8 +126,8 @@ void sbbs_t::putnmsg(int num, char *strin)
void
sbbs_t
::
putnodeext
(
uint
number
,
char
*
ext
)
{
char
str
[
256
];
int
count
=
0
;
char
str
[
MAX_PATH
];
int
count
;
if
(
!
number
||
number
>
cfg
.
sys_nodes
)
{
errormsg
(
WHERE
,
ERR_CHK
,
"node number"
,
number
);
...
...
@@ -133,16 +139,15 @@ void sbbs_t::putnodeext(uint number, char *ext)
errormsg
(
WHERE
,
ERR_OPEN
,
str
,
O_CREAT
|
O_RDWR
|
O_DENYNONE
);
return
;
}
while
(
count
<
LOOP_NODEDAB
)
{
if
(
count
>
10
)
mswait
(
55
);
for
(
count
=
0
;
count
<
LOOP_NODEDAB