Files
roytam1 17528bae8d import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1243352 - attribute a value for ProxyHandlerInfo::mPrefAction in ProxyHandlerInfo::SetPreferredAction. r=blassey (577c23e4cb)
- Bug 1266433 - Send Push observer notifications to parent and content processes. f=janx r=dragana (768c173c2c)
- Bug 1267493 - Replace isURIPotentiallyTrustworthy usage in Push with a testing pref. r=dragana (96434b90d9)
- Bug 1266433 - Send an observer notification when a push subscription is lost. f=janx r=dragana (a7c7277e02)
- Bug 1247685 - Send subscription keys to the Push server. r=mt (651fc0cad3)
- Bug 1266540 - Stub out Push error reporting for the GCM and H2 backends. r=wchen (fd00c311aa)
- Bug 1266623 - Up/down mix WASAPI capture streams when stream formats don't match. r=padenot (ca92ec20ab)
- Bug 1267930 - When the wasapi rendering loop is stuck and we're shuttin down, leak the thread and continue the shutdown process. r=kinetik (04419ad94d)
- Bug 1269692 - Update cubeb to revision 17e3048d0afa1152776fb1867cdb61c49fae69e4. (3de098f4bb)
- Bug 1251502 - Update cubeb's udpate.sh script to account for new files. r=kinetik (a3ae5f27c1)
- Bug 1243234 - Hide MP4Metadata behind an impl pointer. r=giles (1543bedf28)
- Bug 1243234 - Update rust mp4parse telemetry reporting. r=kinetik (bb5c999c06)
- Bug 1242807 - Fix mp4parse-rust's error reporting via telemetry. r=giles (a3ca1b133b)
- Bug 1243234 - Move mp4parse-rust code into MP4MetadataRust impl. r=giles (ec4d6bcf0e)
- Bug 1243234 - Remove now-unnecessary StagefrightPrivate wrapper. r=giles (1e2c54232b)
- Bug 1243234 - Move mp4parse-rust initialization into constructor and clean up try_rust. r=giles (291c01f45a)
- Bug 1243234 - Update rust mp4parse to v0.2.1. r=kinetik (d2774346cd)
- Bug 1264622: [MP4] Resync stagefright's updateAudioTrackInfoFromESDS_MPEG4Audio with upstream. r=kentuckyfriedtakahe (b4b596507b)
- Bug 1254721: Ensure consistency between Cenc offsets and sizes table. r=gerald (59bd7122d1)
- Bug 1151202 - libstagefright: Fix compilation for systems without <sys/cdefs.h>. r=cpearce (e219658c31)
- Bug 1255866 - stagefright: Fix unused variable warnings. r=ajones (62afc26384)
- Bug 1251821: increase UDP socket send buffer on Win 7 r=jdm,jesup (e0d6e545f4)
- Bug 929977: Add support for RFC 7675 ICE consent freshness. r=bwc,mt (ea8a565a65)
- Bug 1231981 - Part 1: Very basic test TURN server for running in CI. r=ahal,drno (c98a79810b)
- Bug 1231981 - Part 2: A websocket-to-process bridge script that can be used by JS to launch an ICE server for testing. r=ahal (5bdb00dfd1)
- Bug 1231981 - Part 2.1: Only run the websocket/process bridge for media tests. r=ahal (86f97e2eb6)
- Bug 1225729: Whitelist specific bad RTCP timestamp value r=drno (f0c8402fd0)
- Bug 1193045 - Check selected attribute for all calls. r=bwc (7eb4095c34)
- Bug 1213056 - update tests to use maplike getStats. r=bwc (d27f997290)
- Bug 1231981 - Part 3: Set up TURN server for webrtc mochitests, when configured to. r=drno (38e4455eec)
- Bug 1231975 - Part 1: Basic audio mochitests for NAT scenarios. r=drno (16efaf581e)
- Bug 1231975 - Part 2: Break a reference cycle between NrTcpSocketIpc and TCPSocketChild, in the same manner as the UDP case. r=mcmanus (1fa55e3e5f)
2024-08-29 00:15:44 +08:00

101 lines
3.0 KiB
Python

# vim: set ts=4 et sw=4 tw=80
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from twisted.internet import protocol, reactor
from twisted.internet.task import LoopingCall
import txws
import psutil
import sys
import os
# maps a command issued via websocket to running an executable with args
commands = {
'iceserver' : [sys.executable,
"-u",
os.path.join("iceserver", "iceserver.py")]
}
class ProcessSide(protocol.ProcessProtocol):
"""Handles the spawned process (I/O, process termination)"""
def __init__(self, socketSide):
self.socketSide = socketSide
def outReceived(self, data):
if self.socketSide:
lines = data.splitlines()
for line in lines:
self.socketSide.transport.write(line)
def errReceived(self, data):
self.outReceived(data)
def processEnded(self, reason):
if self.socketSide:
self.outReceived(str(reason))
self.socketSide.processGone()
def socketGone(self):
self.socketSide = None
self.transport.loseConnection()
self.transport.signalProcess("KILL")
class SocketSide(protocol.Protocol):
"""
Handles the websocket (I/O, closed connection), and spawning the process
"""
def __init__(self):
self.processSide = None
def dataReceived(self, data):
if not self.processSide:
self.processSide = ProcessSide(self)
# We deliberately crash if |data| isn't on the "menu",
# or there is some problem spawning.
reactor.spawnProcess(self.processSide,
commands[data][0],
commands[data],
env=os.environ)
def connectionLost(self, reason):
if self.processSide:
self.processSide.socketGone()
def processGone(self):
self.processSide = None
self.transport.loseConnection()
class ProcessSocketBridgeFactory(protocol.Factory):
"""Builds sockets that can launch/bridge to a process"""
def buildProtocol(self, addr):
return SocketSide()
# Parent process could have already exited, so this is slightly racy. Only
# alternative is to set up a pipe between parent and child, but that requires
# special cooperation from the parent.
parent_process = psutil.Process(os.getpid()).parent()
def check_parent():
""" Checks if parent process is still alive, and exits if not """
if not parent_process.is_running():
print("websocket/process bridge exiting because parent process is gone")
reactor.stop()
if __name__ == "__main__":
parent_checker = LoopingCall(check_parent)
parent_checker.start(1)
bridgeFactory = ProcessSocketBridgeFactory()
reactor.listenTCP(8191, txws.WebSocketFactory(bridgeFactory))
print("websocket/process bridge listening on port 8191")
reactor.run()