@@ -63,9 +63,7 @@ function proxyServer(option){
6363 socketPort = option . socketPort || DEFAULT_WEBSOCKET_PORT , //port for websocket
6464 proxyConfigPort = option . webConfigPort || DEFAULT_CONFIG_PORT , //port to ui config server
6565 disableWebInterface = ! ! option . disableWebInterface ,
66- ifSilent = ! ! option . silent ,
67- webServerInstance ,
68- ws ;
66+ ifSilent = ! ! option . silent ;
6967
7068 if ( ifSilent ) {
7169 logUtil . setPrintStatus ( false ) ;
@@ -131,8 +129,8 @@ function proxyServer(option){
131129
132130 //start web socket service
133131 function ( callback ) {
134- ws = new wsServer ( { port : socketPort } ) ;
135- callback ( null )
132+ self . ws = new wsServer ( { port : socketPort } ) ;
133+ callback ( null ) ;
136134 } ,
137135
138136 //start web interface
@@ -147,7 +145,7 @@ function proxyServer(option){
147145 ip : ip . address ( )
148146 } ;
149147
150- webServerInstance = new webInterface ( config ) ;
148+ self . webServerInstance = new webInterface ( config ) ;
151149 }
152150 callback ( null ) ;
153151 } ,
@@ -189,7 +187,9 @@ function proxyServer(option){
189187
190188 self . close = function ( ) {
191189 self . httpProxyServer && self . httpProxyServer . close ( ) ;
192- logUtil . printLog ( color . green ( "server closed :" + proxyHost + ":" + proxyPort ) ) ;
190+ self . ws && self . ws . closeAll ( ) ;
191+ self . webServerInstance && self . webServerInstance . server && self . webServerInstance . server . close ( ) ;
192+ logUtil . printLog ( "server closed :" + proxyHost + ":" + proxyPort ) ;
193193 }
194194}
195195
0 commit comments