mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-10 02:43:25 +00:00
Fix empty SDP in pooled service offers
The publishInitialService() method was creating an offer with SDP but not returning it. This caused the first offer in the pool to have an empty SDP string, which failed when trying to set it as the local description when an answer arrived. Fixed by: - Storing the offer SDP before closing the peer connection - Adding offerSdp to the return value of publishInitialService() - Using the returned SDP when creating the initial offer in the pool This ensures all offers in the pool have valid SDP that can be used to recreate the peer connection state when answers arrive. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -143,9 +143,9 @@ export class ServicePool {
|
||||
onError: (err, ctx) => this.handleError(err, ctx)
|
||||
});
|
||||
|
||||
// Add all offers to pool
|
||||
// Add all offers to pool (include the SDP from the initial offer)
|
||||
const allOffers = [
|
||||
{ id: service.offerId, peerId: this.credentials.peerId, sdp: '', topics: [], expiresAt: service.expiresAt, lastSeen: Date.now() },
|
||||
{ id: service.offerId, peerId: this.credentials.peerId, sdp: service.offerSdp, topics: [], expiresAt: service.expiresAt, lastSeen: Date.now() },
|
||||
...additionalOffers
|
||||
];
|
||||
await this.offerPool.addOffers(allOffers);
|
||||
@@ -382,6 +382,7 @@ export class ServicePool {
|
||||
serviceId: string;
|
||||
uuid: string;
|
||||
offerId: string;
|
||||
offerSdp: string;
|
||||
expiresAt: number;
|
||||
}> {
|
||||
const { username, privateKey, serviceFqn, rtcConfig, isPublic, metadata, ttl } = this.options;
|
||||
@@ -402,6 +403,9 @@ export class ServicePool {
|
||||
throw new Error('Failed to generate SDP');
|
||||
}
|
||||
|
||||
// Store the SDP before closing
|
||||
const offerSdp = offer.sdp;
|
||||
|
||||
// Create signature
|
||||
const timestamp = Date.now();
|
||||
const message = `publish:${username}:${serviceFqn}:${timestamp}`;
|
||||
@@ -417,7 +421,7 @@ export class ServicePool {
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
serviceFqn,
|
||||
sdp: offer.sdp,
|
||||
sdp: offerSdp,
|
||||
ttl,
|
||||
isPublic,
|
||||
metadata,
|
||||
@@ -439,6 +443,7 @@ export class ServicePool {
|
||||
serviceId: data.serviceId,
|
||||
uuid: data.uuid,
|
||||
offerId: data.offerId,
|
||||
offerSdp,
|
||||
expiresAt: data.expiresAt
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user