File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,16 @@ export default class SocketDaemon extends Daemon {
92
92
* First search in LOOPBACK_ADDRESS, after in LOOPBACK_HOST if in Chrome or Firefox, otherwise vice versa.
93
93
*/
94
94
findAgent ( ) {
95
+ if ( this . pluginURL ) {
96
+ fetch ( `${ this . pluginURL } /info` )
97
+ . then ( response => response . json ( ) . then ( data => {
98
+ this . agentInfo = data ;
99
+ this . agentFound . next ( true ) ;
100
+ } ) )
101
+ . catch ( ( ) => timer ( POLLING_INTERVAL ) . subscribe ( ( ) => this . findAgent ( ) ) ) ;
102
+ return ;
103
+ }
104
+
95
105
this . _tryPorts ( orderedPluginAddresses [ 0 ] )
96
106
. catch ( ( ) => this . _tryPorts ( orderedPluginAddresses [ 1 ] ) )
97
107
. then ( ( ) => this . agentFound . next ( true ) )
@@ -196,9 +206,13 @@ export default class SocketDaemon extends Daemon {
196
206
this . channelOpen . next ( true ) ;
197
207
} ) ;
198
208
199
- this . socket . on ( 'error' , error => this . error . next ( error ) ) ;
209
+ this . socket . on ( 'error' , error => {
210
+ this . socket . disconnect ( ) ;
211
+ this . error . next ( error ) ;
212
+ } ) ;
200
213
201
214
this . socket . on ( 'disconnect' , ( ) => {
215
+ this . socket . disconnect ( ) ;
202
216
this . channelOpen . next ( false ) ;
203
217
} ) ;
204
218
}
You can’t perform that action at this time.
0 commit comments