1. client was instantiated twice, but closed once, leading to a ulimit issue
  2. if there was more than one stat to send, client may be closed too soon. it's easier to create a new client for each send.
This commit is contained in:
Keith Bourgoin 2011-06-05 23:43:47 -04:00
Родитель e6979e9b3c
Коммит 8abe625262
1 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -44,8 +44,6 @@ Client.prototype.send = function (data, sample_rate) {
if (!sample_rate) {
sample_rate = 1;
}
var client = dgram.createSocket('udp4');
sampled_data = {};
if(sample_rate < 1) {
@ -59,8 +57,8 @@ Client.prototype.send = function (data, sample_rate) {
else {
sampled_data=data;
}
var client = dgram.createSocket('udp4');
for (stat in sampled_data) {
var client = dgram.createSocket('udp4');
send_data = stat+":"+sampled_data[stat];
send_data = new Buffer(send_data);
client.send(send_data, 0, send_data.length, self.port, self.host,