File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 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 {
9292 * First search in LOOPBACK_ADDRESS, after in LOOPBACK_HOST if in Chrome or Firefox, otherwise vice versa.
9393 */
9494 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+
95105 this . _tryPorts ( orderedPluginAddresses [ 0 ] )
96106 . catch ( ( ) => this . _tryPorts ( orderedPluginAddresses [ 1 ] ) )
97107 . then ( ( ) => this . agentFound . next ( true ) )
@@ -196,9 +206,13 @@ export default class SocketDaemon extends Daemon {
196206 this . channelOpen . next ( true ) ;
197207 } ) ;
198208
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+ } ) ;
200213
201214 this . socket . on ( 'disconnect' , ( ) => {
215+ this . socket . disconnect ( ) ;
202216 this . channelOpen . next ( false ) ;
203217 } ) ;
204218 }
You can’t perform that action at this time.
0 commit comments