Commit 4ed2af09 authored by Philipp Schafft's avatar Philipp Schafft 🦁
Browse files

Feature: fully support ICY poke requests

parent 60c08666
......@@ -28,7 +28,16 @@
#include <shout/shout.h>
#include "shout_private.h"
int shout_create_icy_request(shout_t *self)
static int shout_create_icy_request_poke(shout_t *self)
{
if (shout_queue_printf(self, "!POKE\nicy-name:libshout server poke request\n\n")) {
return SHOUTERR_MALLOC;
} else {
return SHOUTERR_SUCCESS;
}
}
static int shout_create_icy_request_real(shout_t *self)
{
const char *bitrate;
const char *val;
......@@ -69,3 +78,12 @@ int shout_create_icy_request(shout_t *self)
return ret;
}
int shout_create_icy_request(shout_t *self)
{
if (self->server_caps & LIBSHOUT_CAP_GOTCAPS) {
return shout_create_icy_request_real(self);
} else {
return shout_create_icy_request_poke(self);
}
}
......@@ -105,11 +105,20 @@ int shout_parse_xaudiocast_response(shout_t *self)
if (!strstr(response, "OK")) {
free(response);
return SHOUTERR_NOLOGIN;
/* check to see if that is a response to a POKE. */
if (!(self->server_caps & LIBSHOUT_CAP_GOTCAPS)) {
self->server_caps |= LIBSHOUT_CAP_GOTCAPS;
self->retry++;
if (self->retry > LIBSHOUT_MAX_RETRY)
self->retry = 0;
return SHOUTERR_SOCKET;
} else {
return SHOUTERR_NOLOGIN;
}
}
free(response);
self->server_caps |= LIBSHOUT_CAP_GOTCAPS;
return SHOUTERR_SUCCESS;
}
......@@ -1338,7 +1338,11 @@ retry:
#endif
if (rc != SHOUTERR_SUCCESS && self->retry) {
self->state = SHOUT_STATE_TLS_PENDING;
if (rc == SHOUTERR_SOCKET) {
self->state = SHOUT_STATE_RECONNECT;
} else {
self->state = SHOUT_STATE_TLS_PENDING;
}
goto retry;
}
......@@ -1371,6 +1375,11 @@ retry:
/* special case, no fallthru to this */
case SHOUT_STATE_RECONNECT:
#ifdef HAVE_OPENSSL
if (self->tls)
shout_tls_close(self->tls);
self->tls = NULL;
#endif
sock_close(self->socket);
self->state = SHOUT_STATE_UNCONNECTED;
goto retry;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment