Skip to content

Commit

Permalink
base: Fix the p2p AgentSession registration logic
Browse files Browse the repository at this point in the history
The refactoring in commit 4efb90a ended
up breaking p2p support entirely. Instead of registering an AgentSession
on the connection, we would register an AgentMessageTransmitter.
  • Loading branch information
oleavr committed Apr 21, 2024
1 parent 4bbd034 commit 52005fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions lib/base/session.vala
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ namespace Frida {
public signal void new_candidates (string[] candidate_sdps);
public signal void candidate_gathering_done ();

public weak AgentSession agent_session {
get;
construct;
}

public uint persist_timeout {
get;
construct;
Expand Down Expand Up @@ -198,8 +203,10 @@ namespace Frida {
INTERRUPTED
}

public AgentMessageTransmitter (uint persist_timeout, MainContext frida_context, MainContext dbus_context) {
public AgentMessageTransmitter (AgentSession agent_session, uint persist_timeout, MainContext frida_context,
MainContext dbus_context) {
Object (
agent_session: agent_session,
persist_timeout: persist_timeout,
frida_context: frida_context,
dbus_context: dbus_context
Expand Down Expand Up @@ -500,8 +507,7 @@ namespace Frida {
nice_connection.on_closed.connect (on_nice_connection_closed);

try {
nice_registration_id = nice_connection.register_object (ObjectPath.AGENT_SESSION,
(AgentSession) this);
nice_registration_id = nice_connection.register_object (ObjectPath.AGENT_SESSION, agent_session);
} catch (IOError io_error) {
assert_not_reached ();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/payload/base-agent-session.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Frida {
script_engine.message_from_script.connect (on_message_from_script);
script_engine.message_from_debugger.connect (on_message_from_debugger);

transmitter = new AgentMessageTransmitter (persist_timeout, frida_context, dbus_context);
transmitter = new AgentMessageTransmitter (this, persist_timeout, frida_context, dbus_context);
transmitter.closed.connect (on_transmitter_closed);
transmitter.new_candidates.connect (on_transmitter_new_candidates);
transmitter.candidate_gathering_done.connect (on_transmitter_candidate_gathering_done);
Expand Down
2 changes: 1 addition & 1 deletion src/barebone/barebone-host-session.vala
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ namespace Frida {
assert (frida_context != null);
assert (dbus_context != null);

transmitter = new AgentMessageTransmitter (persist_timeout, frida_context, dbus_context);
transmitter = new AgentMessageTransmitter (this, persist_timeout, frida_context, dbus_context);
transmitter.closed.connect (on_transmitter_closed);
transmitter.new_candidates.connect (on_transmitter_new_candidates);
transmitter.candidate_gathering_done.connect (on_transmitter_candidate_gathering_done);
Expand Down

0 comments on commit 52005fd

Please sign in to comment.