<commit_before>
/*!
 * socket.io-node
 * Copyright(c) 2011 LearnBoost <<EMAIL>>
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var parser = require('./parser');

/**
 * Expose the constructor.
 */

exports = module.exports = Transport;

/**
 * Transport constructor.
 *
 * @api public
 */

function Transport (mng, data) {
  this.manager = mng;
  this.id = data.id;
  this.paused = true;
  this.disconnected = false;
  this.drained = true;
};

/**
 * Sets the corresponding request object.
 */

Transport.prototype.__defineSetter__('request', function (req) {
  this.log.debug('setting request');
  this.handleRequest(req);
});

/**
 * Access the logger.
 *
 * @api public
 */

Transport.prototype.__defineGetter__('log', function () {
  return this.manager.log;
});

/**
 * Access the store.
 *
 * @api public
 */

Transport.prototype.__defineGetter__('store', function () {
  return this.manager.store;
});

/**
 * Handles a request when it's set.
 *
 * @api private
 */

Transport.prototype.handleRequest = function (req) {
  this.req = req;
  
  if (req.method == 'GET') {
    this.socket = req.socket;
    this.open = true;

    var self = this;<commit_msg>Make sure the socket is considered drained when re-set, specially if a socket is closed before its drain event fires.<commit_after>
/*!
 * socket.io-node
 * Copyright(c) 2011 LearnBoost <<EMAIL>>
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var parser = require('./parser');

/**
 * Expose the constructor.
 */

exports = module.exports = Transport;

/**
 * Transport constructor.
 *
 * @api public
 */

function Transport (mng, data) {
  this.manager = mng;
  this.id = data.id;
  this.paused = true;
  this.disconnected = false;
  this.drained = true;
};

/**
 * Sets the corresponding request object.
 */

Transport.prototype.__defineSetter__('request', function (req) {
  this.log.debug('setting request');
  this.handleRequest(req);
});

/**
 * Access the logger.
 *
 * @api public
 */

Transport.prototype.__defineGetter__('log', function () {
  return this.manager.log;
});

/**
 * Access the store.
 *
 * @api public
 */

Transport.prototype.__defineGetter__('store', function () {
  return this.manager.store;
});

/**
 * Handles a request when it's set.
 *
 * @api private
 */

Transport.prototype.handleRequest = function (req) {
  this.req = req;
  
  if (req.method == 'GET') {
    this.socket = req.socket;
    this.open = true;
    this.drained = true;

    var self = this;
{'fraction_non_alphanumeric': 0.1597081475476287, 'fraction_numerical': 0.0032428050263477908, 'mean_word_length': 3.183050847457627, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5475905', 'n_tokens_mistral': 806, 'n_tokens_neox': 790, 'n_words': 198}