Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
0047edd5
Commit
0047edd5
authored
Apr 18, 2008
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small update for failure case. retry times changed and limited redirection allowed
svn path=/icecast/trunk/icecast/; revision=14773
parent
649c4fdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
src/yp.c
src/yp.c
+24
-7
No files found.
src/yp.c
View file @
0047edd5
...
...
@@ -255,6 +255,8 @@ void yp_recheck_config (ice_config_t *config)
curl_easy_setopt
(
server
->
curl
,
CURLOPT_WRITEDATA
,
server
->
curl
);
curl_easy_setopt
(
server
->
curl
,
CURLOPT_TIMEOUT
,
server
->
url_timeout
);
curl_easy_setopt
(
server
->
curl
,
CURLOPT_NOSIGNAL
,
1L
);
curl_easy_setopt
(
server
->
curl
,
CURLOPT_FOLLOWLOCATION
,
1L
);
curl_easy_setopt
(
server
->
curl
,
CURLOPT_MAXREDIRS
,
3L
);
curl_easy_setopt
(
server
->
curl
,
CURLOPT_ERRORBUFFER
,
&
(
server
->
curl_error
[
0
]));
server
->
next
=
(
struct
yp_server
*
)
pending_yps
;
pending_yps
=
server
;
...
...
@@ -285,7 +287,8 @@ void yp_initialize(void)
/* handler for curl, checks if successful handling occurred
* return 0 for ok, -1 for this entry failed, -2 for server fail
* return 0 for ok, -1 for this entry failed, -2 for server fail.
* On failure case, update and process are modified
*/
static
int
send_to_yp
(
const
char
*
cmd
,
ypdata_t
*
yp
,
char
*
post
)
{
...
...
@@ -300,7 +303,7 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
if
(
curlcode
)
{
yp
->
process
=
do_yp_add
;
yp
->
next_update
+=
9
00
;
yp
->
next_update
+=
12
00
;
ERROR2
(
"connection to %s failed with
\"
%s
\"
"
,
server
->
url
,
server
->
curl_error
);
return
-
2
;
}
...
...
@@ -308,9 +311,19 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
{
if
(
yp
->
error_msg
==
NULL
)
yp
->
error_msg
=
strdup
(
"no response from server"
);
if
(
yp
->
process
==
do_yp_add
)
{
ERROR3
(
"YP %s on %s failed: %s"
,
cmd
,
server
->
url
,
yp
->
error_msg
);
yp
->
next_update
+=
7200
;
}
else
{
INFO3
(
"YP %s on %s failed: %s"
,
cmd
,
server
->
url
,
yp
->
error_msg
);
yp
->
next_update
+=
1200
;
}
yp
->
process
=
do_yp_add
;
yp
->
next_update
+=
300
;
ERROR3
(
"YP %s on %s failed: %s"
,
cmd
,
server
->
url
,
yp
->
error_msg
)
;
free
(
yp
->
sid
)
;
yp
->
sid
=
NULL
;
return
-
1
;
}
DEBUG2
(
"YP %s at %s succeeded"
,
cmd
,
server
->
url
);
...
...
@@ -334,9 +347,9 @@ static int do_yp_remove (ypdata_t *yp, char *s, unsigned len)
free
(
yp
->
sid
);
yp
->
sid
=
NULL
;
}
yp_update
=
1
;
yp
->
remove
=
1
;
yp
->
process
=
do_yp_add
;
yp_update
=
1
;
return
ret
;
}
...
...
@@ -455,7 +468,12 @@ static int do_yp_touch (ypdata_t *yp, char *s, unsigned len)
if
(
ret
>=
(
signed
)
len
)
return
ret
+
1
;
/* space required for above text and nul*/
return
send_to_yp
(
"touch"
,
yp
,
s
);
if
(
send_to_yp
(
"touch"
,
yp
,
s
)
==
0
)
{
yp
->
next_update
=
now
+
yp
->
touch_interval
;
return
0
;
}
return
-
1
;
}
...
...
@@ -467,7 +485,6 @@ static int process_ypdata (struct yp_server *server, ypdata_t *yp)
if
(
now
<
yp
->
next_update
)
return
0
;
yp
->
next_update
=
now
+
yp
->
touch_interval
;
/* loop just in case the memory area isn't big enough */
while
(
1
)
...
...
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