@@ -11,24 +11,7 @@ import * as networkConnectionTypes from '../constants/network_connection_action_
1111import * as networkScannerActions from '../actions/network_scanner_actions' ;
1212import * as eonListActions from '../actions/eon_list_actions' ;
1313import ping from 'net-ping' ;
14- function timer ( secs ) {
15- return eventChannel ( emitter => {
16- const iv = setInterval ( ( ) => {
17- secs -= 1 ;
18- if ( secs > 0 ) {
19- emitter ( secs ) ;
20- } else {
21- // this causes the channel to close
22- emitter ( END ) ;
23- }
24- } , 1000 ) ;
25- // The subscriber must return an unsubscribe function
26- return ( ) => {
27- clearInterval ( iv ) ;
28- } ;
29- }
30- ) ;
31- }
14+
3215function revisedRandId ( ) {
3316 return Math . random ( ) . toString ( 36 ) . replace ( / [ ^ a - z ] + / g, '' ) . substr ( 2 , 10 ) ;
3417}
@@ -172,18 +155,23 @@ function* resolveEon(action) {
172155function pingEon ( eon ) {
173156 // console.warn("Pinging EON",eon);
174157 return new Promise ( ( resolve , reject ) => {
175- var session = ping . createSession ( ) ;
158+ try {
159+ var session = ping . createSession ( ) ;
176160
177- session . pingHost ( eon . ip , function pingEon ( error , target ) {
178- if ( error ) {
179- console . warn ( "No response from EON" , error . toString ( ) ) ;
180- reject ( eon , "Could not ping EON..." , error . toString ( ) ) ;
181- } else {
182- resolve ( true ) ;
183- // console.warn("Response found for EON",eon);
184- session . close ( ) ;
185- }
186- } ) ;
161+ session . pingHost ( eon . ip , function pingEon ( error , target ) {
162+ if ( error ) {
163+ console . warn ( "No response from EON" , error . toString ( ) ) ;
164+ reject ( eon , "Could not ping EON..." , error . toString ( ) ) ;
165+ } else {
166+ resolve ( true ) ;
167+ // console.warn("Response found for EON",eon);
168+ session . close ( ) ;
169+ }
170+ } ) ;
171+ } catch ( e ) {
172+ console . warn ( "Cannot ping on this platform..." ) ;
173+ resolve ( true ) ;
174+ }
187175 } ) ;
188176}
189177
@@ -210,7 +198,7 @@ function* pingEons() {
210198 const { foundCount } = networkScanner ;
211199 const { eons, unresolvedEons } = eonList ;
212200 let eonKeys = Object . keys ( eons ) ;
213- rpc . emit ( 'notify' , { title : 'Workbench finished scanning!' , body : `Found ${ foundCount } EON on the network.` } ) ;
201+ // rpc.emit('notify',{title: 'Workbench finished scanning!',body: `Found ${foundCount} EON on the network.`});
214202 // console.warn("Pinging EONS:",eonKeys);
215203 yield all ( eonKeys . map ( function * ( key ) {
216204 const eon = eons [ key ] ;
0 commit comments