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
3d63b35a
Commit
3d63b35a
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Eliminated use of the socket_mutex in ftp_close_socket() - unnecessary.
parent
d031dfef
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/ftpsrvr.c
+1
-33
1 addition, 33 deletions
src/sbbs3/ftpsrvr.c
with
1 addition
and
33 deletions
src/sbbs3/ftpsrvr.c
+
1
−
33
View file @
3d63b35a
...
...
@@ -89,7 +89,6 @@ static SOCKET server_socket=INVALID_SOCKET;
static
DWORD
active_clients
=
0
;
static
DWORD
sockets
=
0
;
static
DWORD
thread_count
=
0
;
static
HANDLE
socket_mutex
=
NULL
;
static
time_t
uptime
=
0
;
static
BOOL
recycle_server
=
FALSE
;
static
char
revision
[
16
];
...
...
@@ -245,22 +244,7 @@ static int ftp_close_socket(SOCKET* sock, int line)
{
int
result
;
#ifndef _WIN32
#define ReleaseMutex(x)
#else
if
(
socket_mutex
!=
NULL
&&
(
result
=
WaitForSingleObject
(
socket_mutex
,
5000
))
!=
WAIT_OBJECT_0
)
lprintf
(
"%04d !ERROR %d getting socket mutex from line %u"
,
*
sock
,
ERROR_VALUE
,
line
);
if
(
IsBadWritePtr
(
sock
,
sizeof
(
SOCKET
)))
{
ReleaseMutex
(
socket_mutex
);
lprintf
(
"0000 !BAD socket pointer in close_socket from line %u"
,
line
);
return
(
-
1
);
}
#endif
if
((
*
sock
)
==
INVALID_SOCKET
)
{
ReleaseMutex
(
socket_mutex
);
lprintf
(
"0000 !INVALID_SOCKET in close_socket from line %u"
,
line
);
return
(
-
1
);
}
...
...
@@ -283,7 +267,6 @@ static int ftp_close_socket(SOCKET* sock, int line)
lprintf
(
"%04d Socket closed (%u sockets in use) from line %u"
,
*
sock
,
sockets
,
line
);
#endif
*
sock
=
INVALID_SOCKET
;
ReleaseMutex
(
socket_mutex
);
return
(
result
);
}
...
...
@@ -1750,7 +1733,7 @@ static void receive_thread(void* arg)
if
(
f
.
desc
[
0
]
==
0
)
/* no description given, use (long) filename */
SAFECOPY
(
f
.
desc
,
getfname
(
xfer
.
filename
));
SAFECOPY
(
f
.
uler
,
xfer
.
user
->
alias
);
SAFECOPY
(
f
.
uler
,
xfer
.
user
->
alias
);
/* exception here, Aug-27-2002 */
if
(
!
addfiledat
(
&
scfg
,
&
f
))
lprintf
(
"%04d !ERROR adding file (%s) to database"
,
xfer
.
ctrl_sock
,
f
.
name
);
...
...
@@ -4250,13 +4233,6 @@ static void cleanup(int code, int line)
lprintf
(
"0000 !WSACleanup ERROR %d"
,
ERROR_VALUE
);
#endif
#ifdef _WIN32
if
(
socket_mutex
!=
NULL
)
{
CloseHandle
(
socket_mutex
);
socket_mutex
=
NULL
;
}
#endif
thread_down
();
status
(
"Down"
);
lprintf
(
"#### FTP Server thread terminated (%u threads remain)"
,
thread_count
);
...
...
@@ -4375,14 +4351,6 @@ void DLLCALL ftp_server(void* arg)
lprintf
(
"Initializing on %.24s with options: %lx"
,
ctime
(
&
t
),
startup
->
options
);
#ifdef _WIN32
if
((
socket_mutex
=
CreateMutex
(
NULL
,
FALSE
,
NULL
))
==
NULL
)
{
lprintf
(
"!ERROR %d creating socket_mutex"
,
GetLastError
());
cleanup
(
1
,
__LINE__
);
return
;
}
#endif
/* Initial configuration and load from CNF files */
SAFECOPY
(
scfg
.
ctrl_dir
,
startup
->
ctrl_dir
);
lprintf
(
"Loading configuration files from %s"
,
scfg
.
ctrl_dir
);
...
...
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