Permalink
Browse files

要らないファイルを削除

  • Loading branch information...
1 parent e35b89b commit b512627929622122fcba95022702152ccade2bc3 @KOBA789 committed Nov 17, 2012
Showing with 0 additions and 46 deletions.
  1. +0 −6 lib/command.log
  2. +0 −40 lib/log_reader.js
View
@@ -1,6 +0,0 @@
-add 8124 www.koba789.com 80
-add 7080 localhost 7080
-remove 7080
-remove 8124
-add 8124 www.koba789.com 80
-remove 8124
View
@@ -1,40 +0,0 @@
-var fs = require('fs'),
- ws = fs.createWriteStream('./command.log', {flags: 'a'});
-
-fs.exists('./command.log', function (exists) {
- if (!exists) {
- return;
- }
- fs.readFile('./command.log', 'utf-8', function (err, data) {
- var lines = data.split('\n').map(function (line) {
- return line.trim();
- }).filter(function (line) {
- return line.length > 0;
- }).map(function (line) {
- return line.split(' ');
- }).filter(function (args) {
- return (args.length === 2 && args[0] === 'remove') || (args.length === 4 && args[0] === 'add');
- }).forEach(function (args) {
- switch (args[0]) {
- case 'add':
- table[Number(args[1])] = {
- host: args[2],
- port: args[3]
- };
- break;
- case 'remove':
- delete table[Number(args[1])];
- break;
- }
- });
-
- for (var key in table) {
- sendToAll({
- type: 'add',
- src: key,
- host: table[key].host,
- port: table[key].port
- });
- }
- });
-});

0 comments on commit b512627

Please sign in to comment.