Skip to content

Commit

Permalink
fix: Temporary fix for JingleSession-s being GC too early (#1019)
Browse files Browse the repository at this point in the history
JingleSessions register with JingleIqHandler which saves a weak
reference and there are no other references to the object until
the session is accepted and saved as Participant.jingleSession. If
the weak reference expires before session-accept is received the
session fails to establish.

This is a quick and dirty fix, a proper solution will follow later.
  • Loading branch information
bgrozev authored Dec 7, 2022
1 parent fe8c958 commit 7f90049
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ private boolean doInviteOrReinvite(Offer offer, ColibriAllocation colibriAllocat
jingleSession.terminate(Reason.UNDEFINED, null, false);
}
jingleSession = participant.createNewJingleSession();
// Save a reference to jingleSession to prevent it from being garbage collected. Temporary fix!
participant.setJingleSessionTmp(jingleSession);
logger.info("Sending session-initiate to: " + participant.getMucJid() + " sources=" + sources);
ack = jingleSession.initiateSession(
offer.getContents(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ open class Participant @JvmOverloads constructor(
addContext("participant", endpointId)
}

// Save a reference to jingleSession to prevent it from being garbage collected. Temporary fix!
var jingleSessionTmp: JingleSession? = null

/**
* The layer which keeps track of which sources have been signaled to this participant.
*/
Expand Down

0 comments on commit 7f90049

Please sign in to comment.