/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['socket.io/transports/flashsocket.js']) {
  _$jscoverage['socket.io/transports/flashsocket.js'] = [];
  _$jscoverage['socket.io/transports/flashsocket.js'][1] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][6] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][7] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][10] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][12] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][14] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][15] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][17] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][18] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][20] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][21] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][22] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][27] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][28] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][29] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][30] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][31] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][32] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][36] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][37] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][40] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][41] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][43] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][44] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][47] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][52] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][53] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][55] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][56] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][57] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][58] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][59] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][60] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][61] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][62] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][68] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][72] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][73] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][76] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][77] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][78] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][79] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][83] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][84] = 0;
  _$jscoverage['socket.io/transports/flashsocket.js'][85] = 0;
}
_$jscoverage['socket.io/transports/flashsocket.js'][1]++;
var net = require("net"), WebSocket = require("./websocket"), listeners = [], netserver;
_$jscoverage['socket.io/transports/flashsocket.js'][6]++;
var Flashsocket = module.exports = (function () {
  _$jscoverage['socket.io/transports/flashsocket.js'][7]++;
  WebSocket.apply(this, arguments);
});
_$jscoverage['socket.io/transports/flashsocket.js'][10]++;
require("sys").inherits(Flashsocket, WebSocket);
_$jscoverage['socket.io/transports/flashsocket.js'][12]++;
Flashsocket.httpUpgrade = true;
_$jscoverage['socket.io/transports/flashsocket.js'][14]++;
Flashsocket.init = (function (listener) {
  _$jscoverage['socket.io/transports/flashsocket.js'][15]++;
  listeners.push(listener);
  _$jscoverage['socket.io/transports/flashsocket.js'][17]++;
  listener.server.on("close", (function () {
  _$jscoverage['socket.io/transports/flashsocket.js'][18]++;
  listeners.splice(listeners.indexOf(listener), 1);
  _$jscoverage['socket.io/transports/flashsocket.js'][20]++;
  if (listeners.length === 0 && netserver) {
    _$jscoverage['socket.io/transports/flashsocket.js'][21]++;
    try {
      _$jscoverage['socket.io/transports/flashsocket.js'][22]++;
      netserver.close();
    }
    catch (e) {
    }
  }
}));
  _$jscoverage['socket.io/transports/flashsocket.js'][27]++;
  if (listener.options.flashPolicyServer && netserver === undefined) {
    _$jscoverage['socket.io/transports/flashsocket.js'][28]++;
    netserver = net.createServer((function (socket) {
  _$jscoverage['socket.io/transports/flashsocket.js'][29]++;
  socket.addListener("error", (function (err) {
  _$jscoverage['socket.io/transports/flashsocket.js'][30]++;
  if (socket && socket.end) {
    _$jscoverage['socket.io/transports/flashsocket.js'][31]++;
    socket.end();
    _$jscoverage['socket.io/transports/flashsocket.js'][32]++;
    socket.destroy();
  }
}));
  _$jscoverage['socket.io/transports/flashsocket.js'][36]++;
  if (socket && socket.readyState == "open") {
    _$jscoverage['socket.io/transports/flashsocket.js'][37]++;
    socket.end(policy(listeners));
  }
}));
    _$jscoverage['socket.io/transports/flashsocket.js'][40]++;
    try {
      _$jscoverage['socket.io/transports/flashsocket.js'][41]++;
      netserver.listen(843);
    }
    catch (e) {
      _$jscoverage['socket.io/transports/flashsocket.js'][43]++;
      if (e.errno == 13) {
        _$jscoverage['socket.io/transports/flashsocket.js'][44]++;
        listener.options.log("Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This might slow down initial connections slightly.");
      }
      _$jscoverage['socket.io/transports/flashsocket.js'][47]++;
      netserver = null;
    }
  }
  _$jscoverage['socket.io/transports/flashsocket.js'][52]++;
  listener.server.addListener("connection", (function (stream) {
  _$jscoverage['socket.io/transports/flashsocket.js'][53]++;
  var flashCheck = (function (data) {
  _$jscoverage['socket.io/transports/flashsocket.js'][55]++;
  stream.removeListener("data", flashCheck);
  _$jscoverage['socket.io/transports/flashsocket.js'][56]++;
  if (data[0] === 60 && data.length == 23) {
    _$jscoverage['socket.io/transports/flashsocket.js'][57]++;
    if (data == "<policy-file-request/>\u0000") {
      _$jscoverage['socket.io/transports/flashsocket.js'][58]++;
      listener.options.log("Answering flash policy request inline");
      _$jscoverage['socket.io/transports/flashsocket.js'][59]++;
      if (stream && stream.readyState == "open") {
        _$jscoverage['socket.io/transports/flashsocket.js'][60]++;
        var xml = policy([listener]);
        _$jscoverage['socket.io/transports/flashsocket.js'][61]++;
        stream.write(xml);
        _$jscoverage['socket.io/transports/flashsocket.js'][62]++;
        stream.end();
      }
    }
  }
});
  _$jscoverage['socket.io/transports/flashsocket.js'][68]++;
  stream.on("data", flashCheck);
}));
});
_$jscoverage['socket.io/transports/flashsocket.js'][72]++;
function policy(listeners) {
  _$jscoverage['socket.io/transports/flashsocket.js'][73]++;
  var xml = "<?xml version=\"1.0\"?>\n<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\n<cross-domain-policy>\n";
  _$jscoverage['socket.io/transports/flashsocket.js'][76]++;
  listeners.forEach((function (l) {
  _$jscoverage['socket.io/transports/flashsocket.js'][77]++;
  [].concat(l.options.origins).forEach((function (origin) {
  _$jscoverage['socket.io/transports/flashsocket.js'][78]++;
  var parts = origin.split(":");
  _$jscoverage['socket.io/transports/flashsocket.js'][79]++;
  xml += "<allow-access-from domain=\"" + parts[0] + "\" to-ports=\"" + parts[1] + "\"/>\n";
}));
}));
  _$jscoverage['socket.io/transports/flashsocket.js'][83]++;
  xml += "</cross-domain-policy>\n";
  _$jscoverage['socket.io/transports/flashsocket.js'][84]++;
  return xml;
}
_$jscoverage['socket.io/transports/flashsocket.js'][85]++;
;
_$jscoverage['socket.io/transports/flashsocket.js'].source = ["var net = require('net')","  , WebSocket = require('./websocket')","  , listeners = []","  , netserver;","","var Flashsocket = module.exports = function(){","  WebSocket.apply(this, arguments);","};","","require('sys').inherits(Flashsocket, WebSocket);","","Flashsocket.httpUpgrade = true;","","Flashsocket.init = function(listener){","  listeners.push(listener);","  ","  listener.server.on('close', function(){","    listeners.splice(listeners.indexOf(listener), 1);","","    if (listeners.length === 0 &amp;&amp; netserver){","      try {","        netserver.close();","      } catch(e){}","    }","  });","  ","  if (listener.options.flashPolicyServer &amp;&amp; netserver === undefined){","    netserver = net.createServer(function(socket){","      socket.addListener('error', function(err){","        if (socket &amp;&amp; socket.end){","          socket.end();","          socket.destroy();","        }","      });","","      if(socket &amp;&amp; socket.readyState == 'open')","        socket.end(policy(listeners));","    });","    ","    try {","      netserver.listen(843);","    } catch(e){","      if (e.errno == 13)","        listener.options.log('Your node instance does not have root privileges. This means that the flash XML'","                          + ' policy file will be served inline instead of on port 843. This might slow down'","                          + ' initial connections slightly.');","      netserver = null;","    }","  }","  ","  // Could not listen on port 843 so policy requests will be inline","  listener.server.addListener('connection', function(stream){","    var flashCheck = function (data) {","      // Only check the initial data","      stream.removeListener(\"data\", flashCheck);","      if (data[0] === 60 &amp;&amp; data.length == 23) {","        if (data == '&lt;policy-file-request/&gt;\\0') {","          listener.options.log(\"Answering flash policy request inline\");","          if (stream &amp;&amp; stream.readyState == 'open'){","            var xml = policy([listener]);","            stream.write(xml);","            stream.end();","          }","        }","      }","    };","    ","    stream.on('data', flashCheck);","  });","};","","function policy(listeners) {","  var xml = '&lt;?xml version=\"1.0\"?&gt;\\n&lt;!DOCTYPE cross-domain-policy SYSTEM'","          + ' \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\"&gt;\\n&lt;cross-domain-policy&gt;\\n';","","  listeners.forEach(function(l){","    [].concat(l.options.origins).forEach(function(origin){","      var parts = origin.split(':');","      xml += '&lt;allow-access-from domain=\"' + parts[0] + '\" to-ports=\"'+ parts[1] +'\"/&gt;\\n';","    });","  });","","  xml += '&lt;/cross-domain-policy&gt;\\n';","  return xml;","};"];
