|
@@ -1,8 +1,6 @@
|
|
1
|
+import { NativeModules } from 'react-native';
|
1
|
2
|
import { RTCPeerConnection, RTCSessionDescription } from 'react-native-webrtc';
|
2
|
3
|
|
3
|
|
-import { Platform } from '../../react';
|
4
|
|
-import { POSIX } from '../../react-native';
|
5
|
|
-
|
6
|
4
|
// XXX At the time of this writing extending RTCPeerConnection using ES6 'class'
|
7
|
5
|
// and 'extends' causes a runtime error related to the attempt to define the
|
8
|
6
|
// onaddstream property setter. The error mentions that babelHelpers.set is
|
|
@@ -169,7 +167,7 @@ function _setRemoteDescription(sessionDescription) {
|
169
|
167
|
function _synthesizeIPv6Addresses(sdp) {
|
170
|
168
|
// The synthesis of IPv6 addresses is implemented on iOS only at the time of
|
171
|
169
|
// this writing.
|
172
|
|
- if (Platform.OS !== 'ios') {
|
|
170
|
+ if (!NativeModules.POSIX) {
|
173
|
171
|
return Promise.resolve(sdp);
|
174
|
172
|
}
|
175
|
173
|
|
|
@@ -199,6 +197,7 @@ function _synthesizeIPv6Addresses0(sessionDescription) {
|
199
|
197
|
let start = 0;
|
200
|
198
|
const lines = [];
|
201
|
199
|
const ips = new Map();
|
|
200
|
+ const getaddrinfo = NativeModules.POSIX.getaddrinfo;
|
202
|
201
|
|
203
|
202
|
do {
|
204
|
203
|
const end = sdp.indexOf('\r\n', start);
|
|
@@ -237,7 +236,7 @@ function _synthesizeIPv6Addresses0(sessionDescription) {
|
237
|
236
|
if (v && typeof v === 'string') {
|
238
|
237
|
resolve(v);
|
239
|
238
|
} else {
|
240
|
|
- POSIX.getaddrinfo(ip).then(
|
|
239
|
+ getaddrinfo(ip).then(
|
241
|
240
|
value => {
|
242
|
241
|
if (value.indexOf(':') === -1
|
243
|
242
|
|| value === ips.get(ip)) {
|