Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix satipc module when TEARDOWN is not correctly handled #1187

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/minisatip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ int read_rtsp(sockets *s) {
LOG("Read RTSP (sock %d, handle %d) [%s:%d] sid %d, len: %d", s->id,
s->sock, get_sockaddr_host(s->sa, ra, sizeof(ra)),
get_sockaddr_port(s->sa), s->sid, rlen);
LOGM("MSG client >> process :\n%s", s->buf);
LOGM("MSG client >> process :\n%s", s->buf); //LOGM->LOG

if ((s->type != TYPE_HTTP) &&
(strncasecmp((const char *)s->buf, "GET", 3) == 0)) {
Expand Down
15 changes: 10 additions & 5 deletions src/satipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ int satipc_reply(sockets *s) {
if (sep)
rc = map_intd(sep + 9, NULL, 0);

LOGM("MSG process << server :\n%s", s->buf);
LOGM("MSG process << server :\n%s", s->buf); //LOGM->LOG
LOG("satipc_reply (adapter %d): sock %d (receiving from handle %d, state %d): "
"[[ code %d ]]",
s->sid, s->sock, s->id, sip->state, rc);
Expand Down Expand Up @@ -295,8 +295,8 @@ int satipc_reply(sockets *s) {
"%d",
sip->id, rc);
}
LOG("satipc %d, expect_reply %d, want_tune %d want commit %d", sip->id,
sip->expect_reply, sip->want_tune, sip->want_commit);
LOG("satipc %d, expect_reply %d, want_tune %d want commit %d, state %d", sip->id,
sip->expect_reply, sip->want_tune, sip->want_commit, sip->state);

if (rc == 200) {
if (is_transport)
Expand Down Expand Up @@ -1270,7 +1270,7 @@ int http_request(adapter *ad, char *url, char *method, int force) {

LOG("satipc_http_request (adapter %d): sock %d: [[ %s %s ]]", ad->id,
remote_socket, method, url);
LOGM("MSG process >> server :\n%s", buf);
LOGM("MSG process >> server :\n%s", buf); //LOGM->LOG

if (remote_socket >= 0) {
sockets_write(remote_socket, buf, lb);
Expand Down Expand Up @@ -1443,7 +1443,7 @@ int satipc_request(adapter *ad) {
return 0;

if ((ad->tp.freq == 0) &&
((sip->state == SATIP_STATE_OPTIONS) ||
((sip->state == SATIP_STATE_OPTIONS) || (sip->state == SATIP_STATE_INACTIVE) ||
(sip->state == SATIP_STATE_SETUP) || (sip->state == SATIP_STATE_PLAY)))
return 0;

Expand All @@ -1457,6 +1457,10 @@ int satipc_request(adapter *ad) {
return 0;
}

// if TEARDOWN has been recently received then re-start the session
if (sip->state == SATIP_STATE_INACTIVE && sip->last_cmd == RTSP_TEARDOWN)
sip->state = SATIP_STATE_SETUP;

// set the init parameters
if (sip->state == SATIP_STATE_OPTIONS) {
sip->sent_transport = 0;
Expand All @@ -1474,6 +1478,7 @@ int satipc_request(adapter *ad) {
sip->state = SATIP_STATE_PLAY;
}

LOGM("satipc: for adapter %d, executing state %d", ad->id, sip->state);
switch (sip->state) {
case SATIP_STATE_OPTIONS:
err = satipc_send_options(ad);
Expand Down
Loading