Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
395f0338
Commit
395f0338
authored
13 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Eliminated unused socket counter variable.
Eliminated some volatile qualifiers.
parent
04df04f4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/services.c
+8
-23
8 additions, 23 deletions
src/sbbs3/services.c
with
8 additions
and
23 deletions
src/sbbs3/services.c
+
8
−
23
View file @
395f0338
...
@@ -69,10 +69,9 @@
...
@@ -69,10 +69,9 @@
static
services_startup_t
*
startup
=
NULL
;
static
services_startup_t
*
startup
=
NULL
;
static
scfg_t
scfg
;
static
scfg_t
scfg
;
static
volatile
ulong
sockets
=
0
;
static
volatile
BOOL
terminated
=
FALSE
;
static
volatile
BOOL
terminated
=
FALSE
;
static
volatile
time_t
uptime
=
0
;
static
time_t
uptime
=
0
;
static
volatile
ulong
served
=
0
;
static
ulong
served
=
0
;
static
char
revision
[
16
];
static
char
revision
[
16
];
static
str_list_t
recycle_semfiles
;
static
str_list_t
recycle_semfiles
;
static
str_list_t
shutdown_semfiles
;
static
str_list_t
shutdown_semfiles
;
...
@@ -91,11 +90,11 @@ typedef struct {
...
@@ -91,11 +90,11 @@ typedef struct {
js_startup_t
js
;
js_startup_t
js
;
js_server_props_t
js_server_props
;
js_server_props_t
js_server_props
;
/* These are run-time state and stat vars */
/* These are run-time state and stat vars */
volatile
ulong
clients
;
ulong
clients
;
volatile
ulong
served
;
ulong
served
;
volatile
SOCKET
socket
;
SOCKET
socket
;
volatile
BOOL
running
;
BOOL
running
;
volatile
BOOL
terminated
;
BOOL
terminated
;
}
service_t
;
}
service_t
;
typedef
struct
{
typedef
struct
{
...
@@ -220,14 +219,9 @@ static SOCKET open_socket(int type, const char* protocol)
...
@@ -220,14 +219,9 @@ static SOCKET open_socket(int type, const char* protocol)
if
(
sock
!=
INVALID_SOCKET
&&
startup
!=
NULL
&&
startup
->
socket_open
!=
NULL
)
if
(
sock
!=
INVALID_SOCKET
&&
startup
!=
NULL
&&
startup
->
socket_open
!=
NULL
)
startup
->
socket_open
(
startup
->
cbdata
,
TRUE
);
startup
->
socket_open
(
startup
->
cbdata
,
TRUE
);
if
(
sock
!=
INVALID_SOCKET
)
{
if
(
sock
!=
INVALID_SOCKET
)
{
sockets
++
;
SAFEPRINTF
(
section
,
"services|%s"
,
protocol
);
SAFEPRINTF
(
section
,
"services|%s"
,
protocol
);
if
(
set_socket_options
(
&
scfg
,
sock
,
section
,
error
,
sizeof
(
error
)))
if
(
set_socket_options
(
&
scfg
,
sock
,
section
,
error
,
sizeof
(
error
)))
lprintf
(
LOG_ERR
,
"%04d !ERROR %s"
,
sock
,
error
);
lprintf
(
LOG_ERR
,
"%04d !ERROR %s"
,
sock
,
error
);
#if 0 /*def _DEBUG */
lprintf(LOG_DEBUG,"%04d Socket opened (%d sockets in use)",sock,sockets);
#endif
}
}
return
(
sock
);
return
(
sock
);
}
}
...
@@ -243,13 +237,8 @@ static int close_socket(SOCKET sock)
...
@@ -243,13 +237,8 @@ static int close_socket(SOCKET sock)
result
=
closesocket
(
sock
);
result
=
closesocket
(
sock
);
if
(
startup
!=
NULL
&&
startup
->
socket_open
!=
NULL
)
if
(
startup
!=
NULL
&&
startup
->
socket_open
!=
NULL
)
startup
->
socket_open
(
startup
->
cbdata
,
FALSE
);
startup
->
socket_open
(
startup
->
cbdata
,
FALSE
);
sockets
--
;
if
(
result
!=
0
)
if
(
result
!=
0
)
lprintf
(
LOG_WARNING
,
"%04d !ERROR %d closing socket"
,
sock
,
ERROR_VALUE
);
lprintf
(
LOG_WARNING
,
"%04d !ERROR %d closing socket"
,
sock
,
ERROR_VALUE
);
#if 0 /*def _DEBUG */
else
lprintf(LOG_DEBUG,"%04d Socket closed (%d sockets in use)",sock,sockets);
#endif
return
(
result
);
return
(
result
);
}
}
...
@@ -1199,7 +1188,7 @@ static void js_service_thread(void* arg)
...
@@ -1199,7 +1188,7 @@ static void js_service_thread(void* arg)
thread_down
();
thread_down
();
lprintf
(
LOG_INFO
,
"%04d %s service thread terminated (%u clients remain, %d total, %lu served)"
lprintf
(
LOG_INFO
,
"%04d %s service thread terminated (%u clients remain, %d total, %lu served)"
,
socket
,
service
->
protocol
,
service
->
clients
,
active_clients
(),
service
->
served
);
,
socket
,
service
->
protocol
,
service
->
clients
,
active_clients
(),
service
->
served
);
client_off
(
socket
);
client_off
(
socket
);
close_socket
(
socket
);
close_socket
(
socket
);
...
@@ -2111,10 +2100,6 @@ void DLLCALL services_thread(void* arg)
...
@@ -2111,10 +2100,6 @@ void DLLCALL services_thread(void* arg)
#endif
#endif
continue
;
continue
;
}
}
sockets
++
;
#if 0 /*def _DEBUG */
lprintf(LOG_DEBUG,"%04d Socket opened (%d sockets in use)",client_socket,sockets);
#endif
if
(
startup
->
socket_open
!=
NULL
)
/* Callback, increments socket counter */
if
(
startup
->
socket_open
!=
NULL
)
/* Callback, increments socket counter */
startup
->
socket_open
(
startup
->
cbdata
,
TRUE
);
startup
->
socket_open
(
startup
->
cbdata
,
TRUE
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment