To disconnect the client I go through the clients array backwards

I'm only using netservices.asc.
load("netservices.asc");
To disconnect the client I go through the clients array backwards, find the
client to disconnect, and disconnect it. (logInfo is a custom function I
added to client objects. It gets called but some clients stay alive)

for ( var i=application.clients.length-1; i>=0; i--){
var difference = nowTimestamp - application.clients[i].lastHeartbeat;
if( difference >= 10*1000 ) {
if( application.clients[i] ){
application.clients[i].logInfo("Timeout: ("+difference/1000+") s"
);
application.disconnect(applica tion.clients[i]);
}
}
}

I'd be just too happy if you can find an error in this way of disconnecting
clients. When I test stuff, I also can't reproduce the problem. My software
is in production, and there it happens. There seem to be two different
kinds of dead client connections. One of them can be disconnected and
the other just can't be killed.

Nhận xét

Bài đăng phổ biến từ blog này

dung lượng RAM lớn nhất mà HĐH cấu trúc 32-bit nhận được

Ký tự viết tắt trong chat & email

Ubuntu LAMP Server