Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
6c6a22bf
Commit
6c6a22bf
authored
Jan 27, 2004
by
Karl Heyes
Browse files
minor cleanups, and only have one thread responding to TERM
svn path=/trunk/avl/; revision=5787
parent
1665a4f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
20 deletions
+29
-20
src/avl/avl.c
src/avl/avl.c
+5
-3
src/logging.c
src/logging.c
+22
-11
src/os.h
src/os.h
+1
-1
src/stats.c
src/stats.c
+0
-4
src/thread/thread.c
src/thread/thread.c
+1
-1
No files found.
src/avl/avl.c
View file @
6c6a22bf
...
...
@@ -22,7 +22,7 @@
*
*/
/* $Id: avl.c,v 1.1
0
200
3/12/04 16:27:30 oddsock
Exp $ */
/* $Id: avl.c,v 1.1
1
200
4/01/27 02:16:25 karl
Exp $ */
/*
* This is a fairly straightfoward translation of a prototype
...
...
@@ -89,7 +89,8 @@ avl_tree_free_helper (avl_node * node, avl_free_key_fun_type free_key_fun)
if
(
node
->
left
)
{
avl_tree_free_helper
(
node
->
left
,
free_key_fun
);
}
free_key_fun
(
node
->
key
);
if
(
free_key_fun
)
free_key_fun
(
node
->
key
);
if
(
node
->
right
)
{
avl_tree_free_helper
(
node
->
right
,
free_key_fun
);
}
...
...
@@ -446,7 +447,8 @@ int avl_delete(avl_tree *tree, void *key, avl_free_key_fun_type free_key_fun)
p
=
x
->
parent
;
/* return the key and node to storage */
free_key_fun
(
x
->
key
);
if
(
free_key_fun
)
free_key_fun
(
x
->
key
);
thread_rwlock_destroy
(
&
x
->
rwlock
);
free
(
x
);
...
...
src/logging.c
View file @
6c6a22bf
...
...
@@ -16,6 +16,7 @@
#include "os.h"
#include "cfgfile.h"
#include "logging.h"
#include "util.h"
#ifdef _WIN32
#define snprintf _snprintf
...
...
@@ -44,33 +45,43 @@ void logging_access(client_t *client)
{
char
datebuf
[
128
];
char
reqbuf
[
1024
];
struct
tm
*
thetime
;
struct
tm
thetime
;
time_t
now
;
time_t
stayed
;
char
*
referrer
,
*
user_agent
;
now
=
time
(
NULL
);
/* build the data */
/* TODO: localtime is not threadsafe on all platforms
** we should probably use localtime_r if it's available
*/
PROTECT_CODE
(
thetime
=
localtime
(
&
now
);
strftime
(
datebuf
,
128
,
LOGGING_FORMAT_CLF
,
thetime
))
localtime_r
(
&
now
,
&
thetime
);
strftime
(
datebuf
,
sizeof
(
datebuf
),
LOGGING_FORMAT_CLF
,
&
thetime
);
/* build the request */
snprintf
(
reqbuf
,
1024
,
"%s %s %s/%s"
,
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_REQ_TYPE
),
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_URI
),
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_PROTOCOL
),
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_VERSION
));
snprintf
(
reqbuf
,
sizeof
(
reqbuf
),
"%s %s %s/%s"
,
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_REQ_TYPE
),
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_URI
),
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_PROTOCOL
),
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_VERSION
));
stayed
=
now
-
client
->
con
->
con_time
;
log_write_direct
(
accesslog
,
"%s - - [%s]
\"
%s
\"
%d %lld
\"
%s
\"
\"
%s
\"
%d"
,
referrer
=
httpp_getvar
(
client
->
parser
,
"referer"
);
if
(
referrer
==
NULL
)
referrer
=
"-"
;
user_agent
=
httpp_getvar
(
client
->
parser
,
"user-agent"
);
if
(
user_agent
==
NULL
)
user_agent
=
"-"
;
log_write_direct
(
accesslog
,
"%s - - [%s]
\"
%s
\"
%d %lld
\"
%s
\"
\"
%s
\"
%u"
,
client
->
con
->
ip
,
datebuf
,
reqbuf
,
client
->
respcode
,
client
->
con
->
sent_bytes
,
(
httpp_getvar
(
client
->
parser
,
"referer"
)
!=
NULL
)
?
httpp_getvar
(
client
->
parser
,
"referer"
)
:
"-"
,
(
httpp_getvar
(
client
->
parser
,
"user-agent"
)
!=
NULL
)
?
httpp_getvar
(
client
->
parser
,
"user-agent"
)
:
"-"
,
(
int
)
stayed
);
referrer
,
user_agent
,
stayed
);
}
...
...
src/os.h
View file @
6c6a22bf
...
...
@@ -15,4 +15,4 @@
#define PATH_SEPARATOR "/"
#endif
#endif
/* __
GLOBAL
S_H__ */
#endif
/* __
O
S_H__ */
src/stats.c
View file @
6c6a22bf
...
...
@@ -455,8 +455,6 @@ static void *_stats_thread(void *arg)
/* wake the other threads so they can shut down cleanly */
thread_cond_broadcast
(
&
_event_signal_cond
);
thread_exit
(
0
);
return
NULL
;
}
...
...
@@ -652,8 +650,6 @@ void *stats_connection(void *arg)
_stats_threads
--
;
thread_mutex_unlock
(
&
_stats_mutex
);
thread_exit
(
0
);
return
NULL
;
}
...
...
src/thread/thread.c
View file @
6c6a22bf
...
...
@@ -222,7 +222,6 @@ static void _block_signals(void)
/* These ones we want */
sigdelset
(
&
ss
,
SIGKILL
);
sigdelset
(
&
ss
,
SIGSTOP
);
sigdelset
(
&
ss
,
SIGTERM
);
sigdelset
(
&
ss
,
SIGSEGV
);
sigdelset
(
&
ss
,
SIGBUS
);
if
(
pthread_sigmask
(
SIG_BLOCK
,
&
ss
,
NULL
)
!=
0
)
{
...
...
@@ -250,6 +249,7 @@ static void _catch_signals(void)
sigaddset
(
&
ss
,
SIGCHLD
);
sigaddset
(
&
ss
,
SIGINT
);
sigaddset
(
&
ss
,
SIGPIPE
);
sigaddset
(
&
ss
,
SIGTERM
);
if
(
pthread_sigmask
(
SIG_UNBLOCK
,
&
ss
,
NULL
)
!=
0
)
{
#ifdef THREAD_DEBUG
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment