|
@@ -4,6 +4,7 @@ import { Socket } from "./socket";
|
|
|
import { MediaConnection } from "./mediaconnection";
|
|
|
import type { DataConnection } from "./dataconnection/DataConnection";
|
|
|
import {
|
|
|
+ BaseConnectionErrorType,
|
|
|
ConnectionType,
|
|
|
PeerErrorType,
|
|
|
ServerMessageType,
|
|
@@ -379,6 +380,16 @@ export class Peer extends EventEmitterWithError<PeerErrorType, PeerEvents> {
|
|
|
PeerErrorType.PeerUnavailable,
|
|
|
`Could not connect to peer ${peerId}`,
|
|
|
);
|
|
|
+ // Emit an error on all connections with this peer.
|
|
|
+ const connections = (this._connections.get(peerId) ?? []).filter(
|
|
|
+ (c) => c.peer === peerId,
|
|
|
+ );
|
|
|
+ for (const conn of connections) {
|
|
|
+ conn.emitError(
|
|
|
+ BaseConnectionErrorType.PeerUnavailable,
|
|
|
+ `${peerId} is unavailable`,
|
|
|
+ );
|
|
|
+ }
|
|
|
break;
|
|
|
case ServerMessageType.Offer: {
|
|
|
// we should consider switching this to CALL/CONNECT, but this is the least breaking option.
|