Skip to content

RDKEMW-6898 : Upgrade GSSDP to latest version#194

Open
balav08 wants to merge 9 commits intomainfrom
feature/RDKEMW-6898_mar27
Open

RDKEMW-6898 : Upgrade GSSDP to latest version#194
balav08 wants to merge 9 commits intomainfrom
feature/RDKEMW-6898_mar27

Conversation

@balav08
Copy link
Copy Markdown

@balav08 balav08 commented Mar 27, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 27, 2026 11:18
@balav08 balav08 requested a review from a team as a code owner March 27, 2026 11:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades the server stack to support newer GSSDP (1.6) and libsoup 3 by conditionally switching build dependencies and source files, plus adding libsoup3-compatible server handling.

Changes:

  • Add libsoup2 vs libsoup3 conditional compilation in gdialservice.cpp for request throttling and URI logging.
  • Update server/CMakeLists.txt to prefer libsoup-3.0 + gssdp-1.6 and switch to gdial1p6-*.c sources when available.
  • Add a libsoup3-specific shield implementation (gdial1p6-shield.c).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

File Description
server/gdialservice.cpp Adds libsoup3 conditionals for callback signatures and URI handling.
server/gdial1p6-shield.c Introduces a libsoup3-oriented connection “shield” implementation.
server/CMakeLists.txt Selects libsoup3 + gssdp-1.6 and switches source lists accordingly.
Comments suppressed due to low confidence (1)

server/CMakeLists.txt:52

  • The if (LIBSOUP3_FOUND) block that selects GSSDP packages is missing a matching endif(). As written, the else() branch for LIBSOUP3_FOUND is never closed, which will cause a CMake configure error (unmatched if/else). Add an endif() after the GSSDP selection logic to properly close the LIBSOUP3_FOUND conditional (and keep the SOUP selection outside of it).
if (LIBSOUP3_FOUND)
  add_definitions(-DHAVE_LIBSOUP_VERSION_3)
  pkg_search_module (GSSDP16 gssdp-1.6)
  if (GSSDP16_FOUND)
    pkg_search_module (GSSDP REQUIRED gssdp-1.6)
    add_definitions(-DHAVE_GSSDP_VERSION_1_6_OR_NEWER)
    message("Using gssdp-1.6")
  endif()
else()
pkg_search_module (GSSDP12 gssdp-1.2)
if (GSSDP12_FOUND)
  pkg_search_module (GSSDP REQUIRED gssdp-1.2)
  add_definitions(-DHAVE_GSSDP_VERSION_1_2_OR_NEWER)
  message("Using gssdp-1.2")
else()
  pkg_search_module (GSSDP REQUIRED gssdp-1.0)
endif()
if (LIBSOUP3_FOUND)
  pkg_search_module (SOUP REQUIRED libsoup-3.0)
  message("Using libsoup-3.0")
else()
  pkg_search_module (SOUP REQUIRED libsoup-2.4)
endif()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +36 to +56
static void server_request_remove_callback (SoupMessage *msg) {
GDIAL_LOGTRACE("Entering ...");
DialShieldConnectionContext * conn_context = (DialShieldConnectionContext *) g_hash_table_lookup(active_conns_, msg);
if (conn_context) {
if (conn_context->read_timeout_source != 0) {
g_print_with_timestamp("server_request_remove_callback tid=[%lx] msg=%p timeout source %d removed",
pthread_self(), msg, conn_context->read_timeout_source);
g_source_remove(conn_context->read_timeout_source);
}
g_hash_table_remove(active_conns_, msg);
g_free(conn_context);
conn_context = NULL;
}
GDIAL_LOGTRACE("Exiting ...");
}

static gboolean soup_message_read_timeout_callback(gpointer user_data) {
SoupMessage *msg = (SoupMessage*)user_data;
GDIAL_LOGTRACE("Entering ...");
DialShieldConnectionContext * conn_context = (DialShieldConnectionContext *)g_hash_table_lookup(active_conns_, msg);
g_print_with_timestamp("soup_message_read_timeout_callback tid=[%lx] msg=%p", pthread_self(), msg);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This libsoup3 shield implementation mixes SoupServerMessage* (signal callbacks) with SoupMessage* (hash-table key type, timeout callback, weak-ref callback). In libsoup3, SoupServerMessage is not a SoupMessage, so these signatures/casts are incorrect and can lead to undefined behavior or hard-to-debug issues. Use SoupServerMessage* consistently throughout (including server_request_remove_callback, soup_message_read_timeout_callback, and the weak-ref callback).

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +97
static void soup_message_weak_ref_callback(gpointer user_data, GObject *obj) {
SoupMessage *msg0=(SoupMessage*)obj;
SoupMessage *msg=(SoupMessage*)user_data;
GDIAL_LOGTRACE("Entering ...");
assert(msg0==msg);
g_print_with_timestamp("soup_message_weak_ref_callback tid=[%lx] msg=%p", pthread_self(), msg);
server_request_remove_callback(msg);
GDIAL_LOGTRACE("Exiting ...");
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soup_message_weak_ref_callback casts the GObject* to SoupMessage* and asserts equality against the user_data pointer. Under libsoup3 the object being finalized is a SoupServerMessage, so these casts are wrong. Update the callback to use SoupServerMessage* (or just compare raw pointers / GObject*) to avoid relying on an unrelated type.

Copilot uses AI. Check for mistakes.
Comment on lines +141 to +143
SoupMessage *msg = (SoupMessage *)key;
server_request_remove_callback(msg);
}
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gdial_shield_term() iterates active_conns_ keys and casts them to SoupMessage*, but in the libsoup3 build the keys are SoupServerMessage* pointers. Keep the key type consistent with the libsoup3 message type to avoid incorrect casts and to make the ownership/lifetime expectations clear.

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +37
if (LIBSOUP3_FOUND)
add_definitions(-DHAVE_LIBSOUP_VERSION_3)
pkg_search_module (GSSDP16 gssdp-1.6)
if (GSSDP16_FOUND)
pkg_search_module (GSSDP REQUIRED gssdp-1.6)
add_definitions(-DHAVE_GSSDP_VERSION_1_6_OR_NEWER)
message("Using gssdp-1.6")
endif()
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When LIBSOUP3_FOUND is true, GSSDP is only set if GSSDP16_FOUND is true; otherwise GSSDP is never marked REQUIRED and ${GSSDP_INCLUDE_DIRS}/${GSSDP_LIBRARIES} may be empty, leading to build/link failures later. If libsoup3 builds require gssdp-1.6, make pkg_search_module(GSSDP REQUIRED gssdp-1.6) unconditional in that branch (or add a clear fallback/error path).

Copilot uses AI. Check for mistakes.
Comment on lines +89 to +90
${CMAKE_CURRENT_SOURCE_DIR}/gdial1p6-rest.c
${CMAKE_CURRENT_SOURCE_DIR}/gdial1p6-ssdp.c
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The libsoup3 source list references gdial1p6-rest.c and gdial1p6-ssdp.c, but the repository files are named with a trailing invisible Unicode mark (e.g., gdial1p6-rest.c‎ / gdial1p6-ssdp.c‎). With the current paths, CMake may fail to locate these sources on disk. Rename the files to plain ASCII .c filenames (preferred) or update the CMake source paths to match the actual filenames.

Suggested change
${CMAKE_CURRENT_SOURCE_DIR}/gdial1p6-rest.c
${CMAKE_CURRENT_SOURCE_DIR}/gdial1p6-ssdp.c
${CMAKE_CURRENT_SOURCE_DIR}/gdial1p6-rest.c
${CMAKE_CURRENT_SOURCE_DIR}/gdial1p6-ssdp.c

Copilot uses AI. Check for mistakes.
@mhughesacn
Copy link
Copy Markdown

Hi @balav08 : Please fix the filenames server/gdial1p6-rest.c and server/gdial1p6-ssdp.c which have trailing non-ascii characters. This breaks the scans and will cause lots of confusion:
server/gdial1p6-rest.c\342\200\216
server/gdial1p6-ssdp.c\342\200\216

@mhughesacn
Copy link
Copy Markdown

Hi @balav08 : Please check server/gdial1p6-rest.c and server/gdial1p6-ssdp.c which have non-ascii characters in the filenames. This is preventing scans and will cause lots of confusion anyway. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants