Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
a922caa7
Commit
a922caa7
authored
May 10, 2005
by
Karl Heyes
Browse files
removed redundant function, add total files requested to stats
svn path=/icecast/trunk/icecast/; revision=9247
parent
99a9e4e3
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/fserve.c
View file @
a922caa7
...
...
@@ -85,7 +85,7 @@ typedef struct {
char
*
type
;
}
mime_type
;
static
int
_free_client
(
void
*
key
);
static
void
fserve_client_destroy
(
fserve_t
*
fclient
);
static
int
_delete_mapping
(
void
*
mapping
);
static
void
*
fserv_thread_function
(
void
*
arg
);
static
void
create_mime_mappings
(
const
char
*
fn
);
...
...
@@ -105,6 +105,7 @@ void fserve_initialize(void)
thread_mutex_create
(
&
pending_lock
);
run_fserv
=
1
;
stats_event
(
NULL
,
"file_connections"
,
"0"
);
fserv_thread
=
thread_create
(
"File Serving Thread"
,
fserv_thread_function
,
NULL
,
THREAD_ATTACHED
);
...
...
@@ -143,7 +144,7 @@ int fserve_client_waiting (void)
}
}
if
(
!
ufds
)
thread_sleep
(
200000
);
thread_sleep
(
200000
);
else
if
(
poll
(
ufds
,
fserve_clients
,
200
)
>
0
)
{
/* mark any clients that are ready */
...
...
@@ -230,7 +231,7 @@ static void wait_for_fds() {
}
/* drop out of here is someone is ready */
if
(
fserve_client_waiting
())
break
;
break
;
}
}
...
...
@@ -260,7 +261,7 @@ static void *fserv_thread_function(void *arg)
fserve_t
*
to_go
=
fclient
;
fclient
=
fclient
->
next
;
*
trail
=
fclient
;
_fre
e_client
(
to_go
);
fserv
e_client
_destroy
(
to_go
);
fserve_clients
--
;
client_tree_changed
=
1
;
continue
;
...
...
@@ -285,7 +286,7 @@ static void *fserv_thread_function(void *arg)
fclient
=
fclient
->
next
;
*
trail
=
fclient
;
fserve_clients
--
;
_fre
e_client
(
to_go
);
fserv
e_client
_destroy
(
to_go
);
client_tree_changed
=
1
;
continue
;
}
...
...
@@ -302,7 +303,7 @@ static void *fserv_thread_function(void *arg)
fserve_t
*
to_go
=
(
fserve_t
*
)
pending_list
;
pending_list
=
to_go
->
next
;
_fre
e_client
(
to_go
);
fserv
e_client
_destroy
(
to_go
);
}
thread_mutex_unlock
(
&
pending_lock
);
...
...
@@ -310,13 +311,13 @@ static void *fserv_thread_function(void *arg)
{
fserve_t
*
to_go
=
active_list
;
active_list
=
to_go
->
next
;
_fre
e_client
(
to_go
);
fserv
e_client
_destroy
(
to_go
);
}
return
NULL
;
}
static
const
char
*
fserve_content_type
(
char
*
path
)
static
const
char
*
fserve_content_type
(
const
char
*
path
)
{
char
*
ext
=
util_get_extension
(
path
);
mime_type
exttype
=
{
ext
,
NULL
};
...
...
@@ -358,7 +359,8 @@ static void fserve_client_destroy(fserve_t *client)
}
}
int
fserve_client_create
(
client_t
*
httpclient
,
char
*
path
)
int
fserve_client_create
(
client_t
*
httpclient
,
const
char
*
path
)
{
fserve_t
*
client
=
calloc
(
1
,
sizeof
(
fserve_t
));
int
bytes
;
...
...
@@ -474,6 +476,7 @@ int fserve_client_create(client_t *httpclient, char *path)
if
(
bytes
>
0
)
httpclient
->
con
->
sent_bytes
=
bytes
;
}
stats_event_inc
(
NULL
,
"file_connections"
);
sock_set_blocking
(
client
->
client
->
con
->
sock
,
SOCK_NONBLOCK
);
sock_set_nodelay
(
client
->
client
->
con
->
sock
);
...
...
@@ -485,14 +488,6 @@ int fserve_client_create(client_t *httpclient, char *path)
return
0
;
}
static
int
_free_client
(
void
*
key
)
{
fserve_t
*
client
=
(
fserve_t
*
)
key
;
fserve_client_destroy
(
client
);
return
1
;
}
static
int
_delete_mapping
(
void
*
mapping
)
{
mime_type
*
map
=
mapping
;
...
...
src/fserve.h
View file @
a922caa7
...
...
@@ -31,7 +31,7 @@ typedef struct _fserve_t
void
fserve_initialize
(
void
);
void
fserve_shutdown
(
void
);
int
fserve_client_create
(
client_t
*
httpclient
,
char
*
path
);
int
fserve_client_create
(
client_t
*
httpclient
,
const
char
*
path
);
#endif
...
...
src/util.c
View file @
a922caa7
...
...
@@ -131,7 +131,7 @@ int util_read_header(int sock, char *buff, unsigned long len, int entire)
return
ret
;
}
char
*
util_get_extension
(
char
*
path
)
{
char
*
util_get_extension
(
const
char
*
path
)
{
char
*
ext
=
strrchr
(
path
,
'.'
);
if
(
ext
==
NULL
)
...
...
@@ -225,7 +225,7 @@ char *util_get_path_from_uri(char *uri) {
}
}
char
*
util_get_path_from_normalised_uri
(
char
*
uri
)
{
char
*
util_get_path_from_normalised_uri
(
const
char
*
uri
)
{
char
*
fullpath
;
char
*
webroot
;
ice_config_t
*
config
=
config_get_config
();
...
...
src/util.h
View file @
a922caa7
...
...
@@ -22,9 +22,9 @@
int
util_timed_wait_for_fd
(
int
fd
,
int
timeout
);
int
util_read_header
(
int
sock
,
char
*
buff
,
unsigned
long
len
,
int
entire
);
int
util_check_valid_extension
(
char
*
uri
);
char
*
util_get_extension
(
char
*
path
);
char
*
util_get_extension
(
const
char
*
path
);
char
*
util_get_path_from_uri
(
char
*
uri
);
char
*
util_get_path_from_normalised_uri
(
char
*
uri
);
char
*
util_get_path_from_normalised_uri
(
const
char
*
uri
);
char
*
util_normalise_uri
(
char
*
uri
);
char
*
util_base64_encode
(
char
*
data
);
char
*
util_base64_decode
(
unsigned
char
*
input
);
...
...
Write
Preview
Supports
Markdown
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