File tree Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -1775,17 +1775,25 @@ class Server {
1775
1775
}
1776
1776
1777
1777
async stop ( ) {
1778
+ if ( this . webSocketProxies . length > 0 ) {
1779
+ this . webSocketProxies = [ ] ;
1780
+ }
1781
+
1782
+ if ( this . staticWatchers . length > 0 ) {
1783
+ await Promise . all ( this . staticWatchers . map ( ( watcher ) => watcher . close ( ) ) ) ;
1784
+
1785
+ this . staticWatchers = [ ] ;
1786
+ }
1787
+
1778
1788
if ( this . webSocketServer ) {
1779
1789
await new Promise ( ( resolve ) => {
1780
1790
this . webSocketServer . implementation . close ( ( ) => {
1781
1791
resolve ( ) ;
1782
1792
} ) ;
1783
1793
} ) ;
1784
- }
1785
-
1786
- await Promise . all ( this . staticWatchers . map ( ( watcher ) => watcher . close ( ) ) ) ;
1787
1794
1788
- this . staticWatchers = [ ] ;
1795
+ this . webSocketServer = null ;
1796
+ }
1789
1797
1790
1798
if ( this . server ) {
1791
1799
await new Promise ( ( resolve ) => {
@@ -1794,17 +1802,23 @@ class Server {
1794
1802
} ) ;
1795
1803
} ) ;
1796
1804
1797
- await new Promise ( ( resolve , reject ) => {
1798
- this . middleware . close ( ( error ) => {
1799
- if ( error ) {
1800
- reject ( error ) ;
1805
+ this . server = null ;
1801
1806
1802
- return ;
1803
- }
1807
+ if ( this . middleware ) {
1808
+ await new Promise ( ( resolve , reject ) => {
1809
+ this . middleware . close ( ( error ) => {
1810
+ if ( error ) {
1811
+ reject ( error ) ;
1804
1812
1805
- resolve ( ) ;
1813
+ return ;
1814
+ }
1815
+
1816
+ resolve ( ) ;
1817
+ } ) ;
1806
1818
} ) ;
1807
- } ) ;
1819
+
1820
+ this . middleware = null ;
1821
+ }
1808
1822
}
1809
1823
}
1810
1824
You can’t perform that action at this time.
0 commit comments