restructure folders

This commit is contained in:
Feross Aboukhadijeh 2015-07-29 00:26:44 -07:00
parent 2dc56de223
commit 3746c05d79
11 changed files with 18 additions and 16 deletions

View File

@ -8,9 +8,9 @@ var parallel = require('run-parallel')
var url = require('url')
var common = require('./lib/common')
var HTTPTracker = require('./lib/http-tracker') // empty object in browser
var UDPTracker = require('./lib/udp-tracker') // empty object in browser
var WebSocketTracker = require('./lib/websocket-tracker')
var HTTPTracker = require('./lib/client/http-tracker') // empty object in browser
var UDPTracker = require('./lib/client/udp-tracker') // empty object in browser
var WebSocketTracker = require('./lib/client/websocket-tracker')
inherits(Client, EventEmitter)

View File

@ -7,7 +7,7 @@ var EventEmitter = require('events').EventEmitter
var get = require('simple-get')
var inherits = require('inherits')
var common = require('./common')
var common = require('../common')
var HTTP_SCRAPE_SUPPORT = /\/(announce)[^\/]*$/
@ -84,9 +84,9 @@ HTTPTracker.prototype.scrape = function (opts) {
// TODO: Improve this interface
HTTPTracker.prototype.setInterval = function (intervalMs) {
var self = this
self._intervalMs = intervalMs
clearInterval(self._interval)
self._intervalMs = intervalMs
if (intervalMs) {
// HACK
var update = self.announce.bind(self, self.client._defaultAnnounceOpts())

View File

@ -9,7 +9,7 @@ var hat = require('hat')
var inherits = require('inherits')
var url = require('url')
var common = require('./common')
var common = require('../common')
var TIMEOUT = 15000

View File

@ -9,7 +9,7 @@ var inherits = require('inherits')
var Peer = require('simple-peer')
var Socket = require('simple-websocket')
var common = require('./common')
var common = require('../common')
// Use a socket pool, so tracker clients share WebSocket objects for the same server.
// In practice, WebSockets are pretty slow to establish, so this gives a nice performance
@ -38,6 +38,7 @@ function WebSocketTracker (client, announceUrl, opts) {
self._peers = {} // peers (offer id -> peer)
self._socket = null
self._intervalMs = self.client._intervalMs // use client interval initially
self._interval = null

View File

@ -5,6 +5,7 @@
var extend = require('xtend/mutable')
exports.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
exports.DEFAULT_ANNOUNCE_INTERVAL_WEBRTC = 60 * 1000 // 1 minute
exports.DEFAULT_ANNOUNCE_PEERS = 50
exports.MAX_ANNOUNCE_PEERS = 82

View File

@ -1,6 +1,6 @@
module.exports = parseHttpRequest
var common = require('./common')
var common = require('../common')
var REMOVE_IPV4_MAPPED_IPV6_RE = /^::ffff:/

View File

@ -2,7 +2,7 @@ module.exports = parseUdpRequest
var bufferEqual = require('buffer-equal')
var ipLib = require('ip')
var common = require('./common')
var common = require('../common')
function parseUdpRequest (msg, rinfo) {
if (msg.length < 16) throw new Error('received packet is too short')

View File

@ -1,6 +1,6 @@
module.exports = parseWebSocketRequest
var common = require('./common')
var common = require('../common')
function parseWebSocketRequest (socket, params) {
params = JSON.parse(params) // may throw

View File

@ -12,8 +12,8 @@
},
"browser": {
"./lib/common-node": false,
"./lib/http-tracker": false,
"./lib/udp-tracker": false,
"./lib/client/http-tracker": false,
"./lib/client/udp-tracker": false,
"./server": false
},
"bugs": {

View File

@ -11,10 +11,10 @@ var string2compact = require('string2compact')
var WebSocketServer = require('ws').Server
var common = require('./lib/common')
var Swarm = require('./lib/swarm')
var parseHttpRequest = require('./lib/parse_http')
var parseUdpRequest = require('./lib/parse_udp')
var parseWebSocketRequest = require('./lib/parse_websocket')
var Swarm = require('./lib/server/swarm')
var parseHttpRequest = require('./lib/server/parse-http')
var parseUdpRequest = require('./lib/server/parse-udp')
var parseWebSocketRequest = require('./lib/server/parse-websocket')
inherits(Server, EventEmitter)