openvidu-server: avoid race condition on GET session (null values)

pull/121/head
pabloFuente 2018-09-24 16:55:44 +02:00
parent dd0016671e
commit bab46cdf8b
3 changed files with 20 additions and 4 deletions

View File

@ -31,6 +31,7 @@ import org.kurento.client.ErrorEvent;
import org.kurento.client.Filter;
import org.kurento.client.GenericMediaElement;
import org.kurento.client.IceCandidate;
import org.kurento.client.IceComponentState;
import org.kurento.client.MediaElement;
import org.kurento.client.MediaPipeline;
import org.kurento.client.MediaType;
@ -665,7 +666,9 @@ public class KurentoParticipant extends Participant {
});
endpoint.getWebEndpoint().addIceComponentStateChangeListener(event -> {
endpoint.kmsEvents.add(new KmsEvent(event, endpoint.createdAt()));
if (!event.getState().equals(IceComponentState.READY)) {
endpoint.kmsEvents.add(new KmsEvent(event, endpoint.createdAt()));
}
});
}

View File

@ -38,6 +38,7 @@ import org.kurento.client.OnIceCandidateEvent;
import org.kurento.client.RtpEndpoint;
import org.kurento.client.SdpEndpoint;
import org.kurento.client.WebRtcEndpoint;
import org.kurento.client.internal.server.KurentoServerException;
import org.kurento.jsonrpc.JsonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -500,7 +501,11 @@ public abstract class MediaEndpoint {
public JsonObject withStatsToJson() {
JsonObject json = new JsonObject();
json.addProperty("createdAt", this.createdAt);
json.addProperty("webrtcTagName", this.getEndpoint().getTag("name"));
try {
json.addProperty("webrtcTagName", this.getEndpoint().getTag("name"));
} catch (KurentoServerException ex) {
json.addProperty("webrtcTagName", "NOT_FOUND");
}
json.add("receivedCandidates", new GsonBuilder().create().toJsonTree(this.receivedCandidateList));
json.addProperty("localCandidate", this.selectedLocalIceCandidate);
json.addProperty("remoteCandidate", this.selectedRemoteIceCandidate);

View File

@ -77,8 +77,16 @@ public class SubscriberEndpoint extends MediaEndpoint {
@Override
public JsonObject toJson() {
JsonObject json = super.toJson();
json.addProperty("streamId", this.publisher.getEndpoint().getTag("name"));
json.addProperty("publisher", this.publisher.getEndpointName());
try {
json.addProperty("streamId", this.publisher.getEndpoint().getTag("name"));
} catch (NullPointerException ex) {
json.addProperty("streamId", "NOT_FOUND");
}
try {
json.addProperty("publisher", this.publisher.getEndpointName());
} catch (NullPointerException ex) {
json.addProperty("publisher", "NOT_FOUND");
}
return json;
}