Skip to content

Commit

Permalink
fix printer
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian committed Jun 22, 2013
1 parent e4770e0 commit 525c021
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 53 deletions.
10 changes: 7 additions & 3 deletions lib/pos_printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ printerQueue = {
// printer = { port :9100, hosts :'localhost'};
if ( printerQueue.running )
return;
printerQueue.running = true;

var job = printerQueue.printQue.shift();
if (job == null)
return;
printerQueue.running = true;
job.printer = { port :9100, hosts :'localhost'};

var opt = {};
Expand All @@ -43,20 +44,23 @@ printerQueue = {

client.on('error', function() {
job.callback('error',job);

printerQueue.running = false;
console.log('connection Error');
});
client.on('close', function() {
printerQueue.running = false;
console.log('closing');
printerQueue.runPrint();
client.unref();
client.destroy();
// client.destroy();

});
client.setTimeout(5000,function(){
console.log('timeout');
printerQueue.running = false;
printerQueue.runPrint();
client.unref();
// client.destroy();
});


Expand Down
3 changes: 1 addition & 2 deletions test/asteroid_client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var chai = require('chai');
chai.should();


var AsteroidClient = require('../lib/asteroid_client.js');

Expand Down
12 changes: 0 additions & 12 deletions test/procfiles/cpuinfo

This file was deleted.

1 change: 0 additions & 1 deletion test/procfiles/loadavg

This file was deleted.

33 changes: 0 additions & 33 deletions test/procfiles/meminfo

This file was deleted.

1 change: 0 additions & 1 deletion test/procfiles/uptime

This file was deleted.

1 change: 0 additions & 1 deletion test/procfiles/version

This file was deleted.

0 comments on commit 525c021

Please sign in to comment.