<commit_before>
var net = require("net")

var telnetServer = net.createServer()
var ActiveUserList = []
var DisconnectedUserList = []
telnetServer.on('connection',function(client){
	client.name = client.remoteAddress+":"+client.remotePort;
	ActiveUserList.push(client)
	broadcast(client.name+" has joined the conversation\r\n")
	client.on('data',function(data){
		broadcast(message,client)
	})
})

function broadcast(message,client){
	var i; 
	for(var i=0;i<ActiveUserList.length;i++){
		if (client !== ActiveUserList[i]){
			if (ActiveUserList[i].writeable){
				ActiveUserList[i].write(client.name+":"+message);
			}
			else{
				DisconnectedUserList.push(ActiveUserList[i]);
				ActiveUserList[i].destroy();
				broadcast(ActiveUserList[i].name+" has left the conversation\r\n")
			}
		}
	}

	for (var j=0;j<DisconnectedUserList.length;j++){
		ActiveUserList.splice(ActiveUserList.indexOf(DisconnectedUserList[j]), 1);
	}
}

telnetServer.listen(23);<commit_msg>Added some debug around writeable test<commit_after>
var net = require("net")


var util = require('util');


var telnetServer = net.createServer()
var ActiveUserList = []
var DisconnectedUserList = []

telnetServer.on('connection',function(client){
	client.name = client.remoteAddress+":"+client.remotePort;
	ActiveUserList.push(client)
	broadcast(client.name+" has joined the conversation\r\n",client)
	client.on('data',function(data){
		broadcast(data,client);
	})
})

function broadcast(message,client){
	var i; 
	for(var i=0;i<ActiveUserList.length;i++){
		console.log(ActiveUserList[i].name);
		if (client !== ActiveUserList[i]){
			console.log(util.inspect(ActiveUserList[i], false, null));
			if (ActiveUserList[i].writeable === true){
				console.log("I am here");
				ActiveUserList[i].write(client.name+":"+message);
			}
			else{
				console.log("Can't write to socket");
//				broadcast(ActiveUserList[i].name+" has left the conversation\r\n",client);
				DisconnectedUserList.push(ActiveUserList[i]);
				ActiveUserList[i].destroy();
			}
		}
	}

	for (var j=0;j<DisconnectedUserList.length;j++){
		ActiveUserList.splice(ActiveUserList.indexOf(DisconnectedUserList[j]), 1);
	}
}

telnetServer.listen(9000);

{'fraction_non_alphanumeric': 0.16384439359267736, 'fraction_numerical': 0.005491990846681922, 'mean_word_length': 5.767801857585139, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 3, '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': '38993', 'n_tokens_mistral': 810, 'n_tokens_neox': 737, 'n_words': 115}