@@ -4,7 +4,6 @@ const series = require('run-series')
44const string2compact = require ( 'string2compact' )
55
66const attachHttpService = require ( './services/attachHttp' )
7- const attachUdpService = require ( './services/attachUdp' )
87const attachWSService = require ( './services/attachWS' )
98const setupStatsRoute = require ( './services/statsRoute' )
109const common = require ( '../lib/common' )
@@ -39,8 +38,6 @@ class Server extends EventEmitter {
3938 this . torrents = { } ;
4039
4140 this . http = null ;
42- this . udp4 = null ;
43- this . udp6 = null ;
4441 this . ws = null ;
4542
4643 debug ( "new server %s" , JSON . stringify ( opts ) ) ;
@@ -61,10 +58,10 @@ class Server extends EventEmitter {
6158
6259 if ( opts . http !== false ) attachHttpService ( this , onListening ) ;
6360 if ( opts . ws !== false ) attachWSService ( this , onListening ) ;
64- if ( opts . udp !== false ) attachUdpService ( this , onListening ) ;
6561 if ( opts . stats !== false ) setupStatsRoute ( this , onListening ) ;
6662
67- let num = ! ! this . http + ! ! this . udp4 + ! ! this . udp6
63+ // TODO: UGH
64+ let num = ! ! this . http
6865 this . num = num
6966
7067 const self = this
@@ -78,16 +75,6 @@ class Server extends EventEmitter {
7875 }
7976 }
8077
81- onListening ( ) {
82- this . num -= 1
83-
84- if ( this . num === 0 ) {
85- this . listening = true
86- debug ( 'listening' )
87- this . emit ( 'listening' )
88- }
89- }
90-
9178 onError ( err ) {
9279 this . emit ( 'error' , err )
9380 }
@@ -109,17 +96,12 @@ class Server extends EventEmitter {
10996 }
11097
11198 const httpPort = isObject ( port ) ? ( port . http || 0 ) : port
112- const udpPort = isObject ( port ) ? ( port . udp || 0 ) : port
11399
114100 // binding to :: only receives IPv4 connections if the bindv6only sysctl is set 0,
115101 // which is the default on many operating systems
116102 const httpHostname = isObject ( hostname ) ? hostname . http : hostname
117- const udp4Hostname = isObject ( hostname ) ? hostname . udp : hostname
118- const udp6Hostname = isObject ( hostname ) ? hostname . udp6 : hostname
119103
120104 if ( this . http ) this . http . listen ( httpPort , httpHostname )
121- if ( this . udp4 ) this . udp4 . bind ( udpPort , udp4Hostname )
122- if ( this . udp6 ) this . udp6 . bind ( udpPort , udp6Hostname )
123105 }
124106
125107 close ( cb ) {
@@ -138,10 +120,7 @@ class Server extends EventEmitter {
138120 }
139121 }
140122
141- [ this . udp4 ,
142- this . udp6 ,
143- this . ws
144- ] . forEach ( closeService )
123+ closeService ( this . ws )
145124
146125 if ( this . http ) this . http . close ( cb )
147126 else cb ( null )
0 commit comments