package torrent
+
+import (
+       "iter"
+
+       g "github.com/anacrolix/generics"
+)
+
+// Returns Some of the last item in a iter.Seq, or None if the sequence is empty.
+func seqLast[V any](seq iter.Seq[V]) (last g.Option[V]) {
+       for item := range seq {
+               last.Set(item)
+       }
+       return
+}
 
        maxLocalToRemoteRequests = (writeBufferHighWaterLen - writeBufferLowWaterLen - interestedMsgLen) / requestMsgLen
 )
 
-// The actual value to use as the maximum outbound requests.
-func (cn *PeerConn) nominalMaxRequests() maxRequests {
-       // TODO: This should differ for webseeds...
-       return max(1, min(cn.PeerMaxRequests, cn.peakRequests*2, maxLocalToRemoteRequests))
-}
-
 func (cn *Peer) totalExpectingTime() (ret time.Duration) {
        ret = cn.cumulativeExpectedToReceiveChunks
        if !cn.lastStartedExpectingToReceiveChunks.IsZero() {
 
 func (me *PeerConn) peerPtr() *Peer {
        return &me.Peer
 }
+
+// The actual value to use as the maximum outbound requests.
+func (cn *PeerConn) nominalMaxRequests() maxRequests {
+       return max(1, min(cn.PeerMaxRequests, cn.peakRequests*2, maxLocalToRemoteRequests))
+}
 
        }
 }
 
-// Returns Some of the last item in a iter.Seq, or None if the sequence is empty.
-func seqLast[V any](seq iter.Seq[V]) (last g.Option[V]) {
-       for item := range seq {
-               last.Set(item)
-       }
-       return
-}
-
 func (ws *webseedPeer) iterConsecutiveRequests(begin RequestIndex) iter.Seq[RequestIndex] {
        return func(yield func(RequestIndex) bool) {
                for {