@@ -1746,7 +1746,7 @@ func (t *Torrent) openNewConns(lock bool) (initiated int) {
17461746 receivedHolepunchConnect : false ,
17471747 HeaderObfuscationPolicy : t .cl .config .HeaderObfuscationPolicy ,
17481748 }
1749- initiateConn (opts , false , false , false )
1749+ initiateConn (opts , false , false )
17501750 initiated ++
17511751 }
17521752
@@ -2533,10 +2533,6 @@ func (t *Torrent) wantOutgoingConns(lock bool) bool {
25332533 conns := t .peerConnsAsSlice (lock )
25342534 defer conns .free ()
25352535
2536- if len (conns ) < t .maxEstablishedConns {
2537- return true
2538- }
2539-
25402536 numOutgoingConns := conns .numOutgoingConns ()
25412537 numIncomingConns := len (conns ) - numOutgoingConns
25422538
@@ -3113,15 +3109,9 @@ func (t *Torrent) addHalfOpen(addrStr string, attemptKey *PeerInfo, lock bool) {
31133109
31143110// Start the process of connecting to the given peer for the given torrent if appropriate. I'm not
31153111// sure all the PeerInfo fields are being used.
3116- func initiateConn (opts outgoingConnOpts , ignoreLimits bool , lock bool , lockCLient bool ) {
3112+ func initiateConn (opts outgoingConnOpts , ignoreLimits bool , lock bool ) {
31173113 t := opts .t
31183114 peer := opts .peerInfo
3119-
3120- if lockCLient {
3121- t .cl .rLock ()
3122- defer t .cl .rUnlock ()
3123- }
3124-
31253115 if peer .Id == t .cl .peerID {
31263116 return
31273117 }
@@ -3661,14 +3651,12 @@ func (t *Torrent) handleReceivedUtHolepunchMsg(msg utHolepunch.Msg, sender *Peer
36613651 case utHolepunch .Connect :
36623652 holepunchAddr := msg .AddrPort
36633653 t .logger .Printf ("got holepunch connect request for %v from %p" , holepunchAddr , sender )
3664- t .cl .lock ()
36653654 if g .MapContains (t .cl .undialableWithoutHolepunch , holepunchAddr ) {
36663655 setAdd (& t .cl .undialableWithoutHolepunchDialedAfterHolepunchConnect , holepunchAddr )
36673656 if g .MapContains (t .cl .accepted , holepunchAddr ) {
36683657 setAdd (& t .cl .probablyOnlyConnectedDueToHolepunch , holepunchAddr )
36693658 }
36703659 }
3671- t .cl .unlock ()
36723660 opts := outgoingConnOpts {
36733661 peerInfo : PeerInfo {
36743662 Addr : msg .AddrPort ,
@@ -3683,7 +3671,7 @@ func (t *Torrent) handleReceivedUtHolepunchMsg(msg utHolepunch.Msg, sender *Peer
36833671 // encryption. So we will act normally.
36843672 HeaderObfuscationPolicy : t .cl .config .HeaderObfuscationPolicy ,
36853673 }
3686- initiateConn (opts , true , true , true )
3674+ initiateConn (opts , true , true )
36873675 return nil
36883676 case utHolepunch .Error :
36893677 torrent .Add ("holepunch error messages received" , 1 )
0 commit comments