mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
FIX: tcp module warnings
This commit is contained in:
parent
c7be4fb3e4
commit
8a4bd4d8a6
7 changed files with 42 additions and 29 deletions
|
@ -14,6 +14,8 @@ import TcpSocket from 'react-native-tcp-socket';
|
||||||
*/
|
*/
|
||||||
function Socket() {
|
function Socket() {
|
||||||
this._socket = false; // reference to socket thats gona be created later
|
this._socket = false; // reference to socket thats gona be created later
|
||||||
|
// defaults:
|
||||||
|
this._noDelay = true;
|
||||||
|
|
||||||
this._listeners = {};
|
this._listeners = {};
|
||||||
|
|
||||||
|
@ -21,7 +23,12 @@ function Socket() {
|
||||||
this.setTimeout = () => {};
|
this.setTimeout = () => {};
|
||||||
this.setEncoding = () => {};
|
this.setEncoding = () => {};
|
||||||
this.setKeepAlive = () => {};
|
this.setKeepAlive = () => {};
|
||||||
this.setNoDelay = () => {};
|
|
||||||
|
// proxying call to real socket object:
|
||||||
|
this.setNoDelay = noDelay => {
|
||||||
|
if (this._socket) this._socket.setNoDelay(noDelay);
|
||||||
|
this._noDelay = noDelay;
|
||||||
|
};
|
||||||
|
|
||||||
this.connect = (port, host, callback) => {
|
this.connect = (port, host, callback) => {
|
||||||
this._socket = TcpSocket.createConnection(
|
this._socket = TcpSocket.createConnection(
|
||||||
|
@ -36,15 +43,6 @@ function Socket() {
|
||||||
this._socket.on('data', data => {
|
this._socket.on('data', data => {
|
||||||
this._passOnEvent('data', data);
|
this._passOnEvent('data', data);
|
||||||
});
|
});
|
||||||
this._socket.on('end', data => {
|
|
||||||
this._passOnEvent('end', data);
|
|
||||||
});
|
|
||||||
this._socket.on('timeout', () => {
|
|
||||||
this._passOnEvent('timeout');
|
|
||||||
});
|
|
||||||
this._socket.on('onerror', data => {
|
|
||||||
this._passOnEvent('onerror', data);
|
|
||||||
});
|
|
||||||
this._socket.on('error', data => {
|
this._socket.on('error', data => {
|
||||||
this._passOnEvent('error', data);
|
this._passOnEvent('error', data);
|
||||||
});
|
});
|
||||||
|
@ -53,9 +51,7 @@ function Socket() {
|
||||||
});
|
});
|
||||||
this._socket.on('connect', data => {
|
this._socket.on('connect', data => {
|
||||||
this._passOnEvent('connect', data);
|
this._passOnEvent('connect', data);
|
||||||
});
|
this._socket.setNoDelay(this._noDelay);
|
||||||
this._socket.on('secureConnect', data => {
|
|
||||||
this._passOnEvent('secureConnect', data);
|
|
||||||
});
|
});
|
||||||
this._socket.on('connection', data => {
|
this._socket.on('connection', data => {
|
||||||
this._passOnEvent('connection', data);
|
this._passOnEvent('connection', data);
|
||||||
|
|
|
@ -22,10 +22,23 @@ function connect(config, callback) {
|
||||||
callback,
|
callback,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// defaults:
|
||||||
|
this._noDelay = true;
|
||||||
|
|
||||||
// functions not supported by RN module, yet:
|
// functions not supported by RN module, yet:
|
||||||
|
client.setTimeout = () => {};
|
||||||
client.setEncoding = () => {};
|
client.setEncoding = () => {};
|
||||||
client.setKeepAlive = () => {};
|
client.setKeepAlive = () => {};
|
||||||
client.setNoDelay = () => {};
|
|
||||||
|
// we will save `noDelay` and proxy it to socket object when its actually created and connected:
|
||||||
|
const realSetNoDelay = client.setNoDelay; // reference to real setter
|
||||||
|
client.setNoDelay = noDelay => {
|
||||||
|
this._noDelay = noDelay;
|
||||||
|
};
|
||||||
|
|
||||||
|
client.on('connect', () => {
|
||||||
|
realSetNoDelay.apply(client, [this._noDelay]);
|
||||||
|
});
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ PODS:
|
||||||
- boost-for-react-native (1.63.0)
|
- boost-for-react-native (1.63.0)
|
||||||
- BVLinearGradient (2.5.6):
|
- BVLinearGradient (2.5.6):
|
||||||
- React
|
- React
|
||||||
|
- CocoaAsyncSocket (7.6.4)
|
||||||
- DoubleConversion (1.1.6)
|
- DoubleConversion (1.1.6)
|
||||||
- EFQRCode (5.1.0):
|
- EFQRCode (5.1.0):
|
||||||
- swift_qrcodejs (~> 1.1.1)
|
- swift_qrcodejs (~> 1.1.1)
|
||||||
|
@ -214,7 +215,8 @@ PODS:
|
||||||
- React
|
- React
|
||||||
- react-native-slider (2.0.8):
|
- react-native-slider (2.0.8):
|
||||||
- React
|
- React
|
||||||
- react-native-tcp (3.3.2):
|
- react-native-tcp-socket (3.7.1):
|
||||||
|
- CocoaAsyncSocket
|
||||||
- React
|
- React
|
||||||
- react-native-webview (6.11.1):
|
- react-native-webview (6.11.1):
|
||||||
- React
|
- React
|
||||||
|
@ -283,7 +285,7 @@ PODS:
|
||||||
- React
|
- React
|
||||||
- RNSecureKeyStore (1.0.0):
|
- RNSecureKeyStore (1.0.0):
|
||||||
- React
|
- React
|
||||||
- RNSentry (1.3.7):
|
- RNSentry (1.3.9):
|
||||||
- React
|
- React
|
||||||
- Sentry (~> 4.4.0)
|
- Sentry (~> 4.4.0)
|
||||||
- RNShare (2.0.0):
|
- RNShare (2.0.0):
|
||||||
|
@ -331,7 +333,7 @@ DEPENDENCIES:
|
||||||
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
|
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
|
||||||
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
|
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
|
||||||
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
|
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
|
||||||
- react-native-tcp (from `../node_modules/react-native-tcp`)
|
- react-native-tcp-socket (from `../node_modules/react-native-tcp-socket`)
|
||||||
- react-native-webview (from `../node_modules/react-native-webview`)
|
- react-native-webview (from `../node_modules/react-native-webview`)
|
||||||
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
||||||
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
|
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
|
||||||
|
@ -370,6 +372,7 @@ DEPENDENCIES:
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
- boost-for-react-native
|
- boost-for-react-native
|
||||||
|
- CocoaAsyncSocket
|
||||||
- EFQRCode
|
- EFQRCode
|
||||||
- lottie-ios
|
- lottie-ios
|
||||||
- Sentry
|
- Sentry
|
||||||
|
@ -426,8 +429,8 @@ EXTERNAL SOURCES:
|
||||||
:path: "../node_modules/react-native-safe-area-context"
|
:path: "../node_modules/react-native-safe-area-context"
|
||||||
react-native-slider:
|
react-native-slider:
|
||||||
:path: "../node_modules/@react-native-community/slider"
|
:path: "../node_modules/@react-native-community/slider"
|
||||||
react-native-tcp:
|
react-native-tcp-socket:
|
||||||
:path: "../node_modules/react-native-tcp"
|
:path: "../node_modules/react-native-tcp-socket"
|
||||||
react-native-webview:
|
react-native-webview:
|
||||||
:path: "../node_modules/react-native-webview"
|
:path: "../node_modules/react-native-webview"
|
||||||
React-RCTActionSheet:
|
React-RCTActionSheet:
|
||||||
|
@ -498,6 +501,7 @@ EXTERNAL SOURCES:
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
|
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
|
||||||
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
|
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
|
||||||
|
CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845
|
||||||
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
|
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
|
||||||
EFQRCode: 07ee69f29196329e974b9bffa5381240cc09ea4c
|
EFQRCode: 07ee69f29196329e974b9bffa5381240cc09ea4c
|
||||||
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
|
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
|
||||||
|
@ -524,7 +528,7 @@ SPEC CHECKSUMS:
|
||||||
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
|
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
|
||||||
react-native-safe-area-context: 0b0460e3298465bdb4b859ea43c2d7b9128cf988
|
react-native-safe-area-context: 0b0460e3298465bdb4b859ea43c2d7b9128cf988
|
||||||
react-native-slider: b2f361499888302147205f17f6fffa921a7bda70
|
react-native-slider: b2f361499888302147205f17f6fffa921a7bda70
|
||||||
react-native-tcp: be8e119e631970aaeda7f6e3207f6b7be72d5eb8
|
react-native-tcp-socket: 96a4f104cdcc9c6621aafe92937f163d88447c5b
|
||||||
react-native-webview: f11ac6c8bcaba5b71ddda1c12a10c8ea059b080f
|
react-native-webview: f11ac6c8bcaba5b71ddda1c12a10c8ea059b080f
|
||||||
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
||||||
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
|
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
|
||||||
|
@ -551,7 +555,7 @@ SPEC CHECKSUMS:
|
||||||
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
|
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
|
||||||
RNScreens: 62211832af51e0aebcf6e8c36bcf7dd65592f244
|
RNScreens: 62211832af51e0aebcf6e8c36bcf7dd65592f244
|
||||||
RNSecureKeyStore: f1ad870e53806453039f650720d2845c678d89c8
|
RNSecureKeyStore: f1ad870e53806453039f650720d2845c678d89c8
|
||||||
RNSentry: 370623102247ebea20191b5fb549ecc7a275b324
|
RNSentry: 9c9783b13fb5cba387fff55f085cc1da3854ce71
|
||||||
RNShare: 8b171d4b43c1d886917fdd303bf7a4b87167b05c
|
RNShare: 8b171d4b43c1d886917fdd303bf7a4b87167b05c
|
||||||
RNSVG: 8ba35cbeb385a52fd960fd28db9d7d18b4c2974f
|
RNSVG: 8ba35cbeb385a52fd960fd28db9d7d18b4c2974f
|
||||||
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
|
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -12087,9 +12087,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-native-tcp-socket": {
|
"react-native-tcp-socket": {
|
||||||
"version": "3.6.0",
|
"version": "3.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-tcp-socket/-/react-native-tcp-socket-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-tcp-socket/-/react-native-tcp-socket-3.7.1.tgz",
|
||||||
"integrity": "sha512-lGnlklcHNCQSgdVhrF4fwslc6Xjk3nXLVqjqvJY1pSEJ9H8S4clZR4uwohfbM16VrHnUhBh4o/1wGRO/xrp7nQ==",
|
"integrity": "sha512-ToyFSYuJp0/DQ7bXd/vTwF5m3yhNSRngIpVlBFBDccDZQmp2qIo0exrObCNlJLOOHb38dil726hM+GKjR1/60w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"buffer": "^5.4.3"
|
"buffer": "^5.4.3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
"react-native-snap-carousel": "3.9.1",
|
"react-native-snap-carousel": "3.9.1",
|
||||||
"react-native-sortable-list": "0.0.24",
|
"react-native-sortable-list": "0.0.24",
|
||||||
"react-native-svg": "9.13.6",
|
"react-native-svg": "9.13.6",
|
||||||
"react-native-tcp-socket": "3.6.0",
|
"react-native-tcp-socket": "3.7.1",
|
||||||
"react-native-tooltip": "git+https://github.com/marcosrdz/react-native-tooltip.git",
|
"react-native-tooltip": "git+https://github.com/marcosrdz/react-native-tooltip.git",
|
||||||
"react-native-vector-icons": "6.6.0",
|
"react-native-vector-icons": "6.6.0",
|
||||||
"react-native-watch-connectivity": "0.4.2",
|
"react-native-watch-connectivity": "0.4.2",
|
||||||
|
|
|
@ -32,9 +32,6 @@ const styles = StyleSheet.create({
|
||||||
paddingRight: 16,
|
paddingRight: 16,
|
||||||
borderRadius: 20,
|
borderRadius: 20,
|
||||||
},
|
},
|
||||||
connectText: {
|
|
||||||
fontWeight: '600',
|
|
||||||
},
|
|
||||||
containerConnected: {
|
containerConnected: {
|
||||||
backgroundColor: '#D2F8D6',
|
backgroundColor: '#D2F8D6',
|
||||||
},
|
},
|
||||||
|
@ -43,9 +40,11 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
textConnected: {
|
textConnected: {
|
||||||
color: '#37C0A1',
|
color: '#37C0A1',
|
||||||
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
textDisconnected: {
|
textDisconnected: {
|
||||||
color: '#D0021B',
|
color: '#D0021B',
|
||||||
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
hostname: {
|
hostname: {
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
@ -161,7 +160,7 @@ export default class ElectrumSettings extends Component {
|
||||||
<BlueText style={styles.status}>Status</BlueText>
|
<BlueText style={styles.status}>Status</BlueText>
|
||||||
<View style={styles.connectWrap}>
|
<View style={styles.connectWrap}>
|
||||||
<View style={[styles.container, this.state.config.status === 1 ? styles.containerConnected : styles.containerDisconnected]}>
|
<View style={[styles.container, this.state.config.status === 1 ? styles.containerConnected : styles.containerDisconnected]}>
|
||||||
<BlueText style={[styles.connectText, this.state.config.status === 1 ? styles.textConnected : styles.textDisconnected]}>
|
<BlueText style={this.state.config.status === 1 ? styles.textConnected : styles.textDisconnected}>
|
||||||
{(this.state.config.status === 1 && 'Connected') || 'Not Connected'}
|
{(this.state.config.status === 1 && 'Connected') || 'Not Connected'}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -200,6 +200,7 @@ export default class WalletsList extends Component {
|
||||||
await BlueApp.fetchWalletTransactions();
|
await BlueApp.fetchWalletTransactions();
|
||||||
const end = +new Date();
|
const end = +new Date();
|
||||||
console.log('fetch all wallet txs took', (end - start) / 1000, 'sec');
|
console.log('fetch all wallet txs took', (end - start) / 1000, 'sec');
|
||||||
|
await BlueApp.saveToDisk();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue