Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Trap.ServerEndpoint=function(b){Trap.Endpoint.prototype.constructor.call(this);this.listener=b;this.setState(Trap.Endpoint.State.OPENING);this.maxActiveTransports=Number.MAX_VALUE};Trap.ServerEndpoint.prototype=new Trap.Endpoint;Trap.ServerEndpoint.prototype.constructor=Trap.ServerEndpoint;Trap.ServerEndpoint.prototype.createOnOpenedMessage=function(m){console.log("Creating onOpened message");var l=Trap.Endpoint.prototype.createOnOpenedMessage.call(this,m);var i=new Trap.Configuration(m.getDataAsString());var h=i.getBooleanOption(Trap.Constants.OPTION_ENABLE_COMPRESSION,false);this.config.setOption(Trap.Constants.OPTION_ENABLE_COMPRESSION,h);this.compressionEnabled=h;var n=i.getOption(Trap.Constants.CONFIG_HASH_PROPERTY);if(n==null){this.logger.trace("Client did not request updated configuration...");return l}var j=this.listenerTrapEndpoint.getClientConfiguration(true);if(j.length==0){this.logger.debug("Automatic configuration update disabled; at least one transport did not have a non-zero IP number configured")}var k=Trap.MD5(j);if(k==n){this.logger.debug("Client configuration was up to date");return l}this.logger.debug("Sending updated configuration to the client");l.setData(j);return l};Trap.ServerEndpoint.prototype.reconnect=function(b){this.setState(Trap.Endpoint.State.CLOSED)};Trap.ServerEndpoint.prototype.ttStateChanged=function(i,f,h,j){Trap.Endpoint.prototype.ttStateChanged.call(this,i,f,h,j);if((i==Trap.Transport.State.DISCONNECTED)||(i==Trap.Transport.State.ERROR)){if((this.getState()==Trap.Endpoint.State.CLOSING)||(this.getState()==Trap.Endpoint.State.CLOSED)){}else{if(this.availableTransports.size()==0){this.setState(Trap.Endpoint.State.SLEEPING);var g=this;setTimeout(function(){if(g.getState()==Trap.Endpoint.State.SLEEPING){var a=g.transports.iterator();while(a.hasNext()){a.next().disconnect()}g.setState(Trap.Endpoint.State.CLOSED)}},this.reconnectTimeout)}}}};Trap.ServerEndpoint.prototype.isAlive=function(d,c){return this.isAlive(d,true,false,d,c)};Trap.ServerEndpoint.prototype.close=function(){Trap.Endpoint.prototype.close.call(this);this.listener.endpoints.remove(this.trapID)};
New to GrepCode? Check out our FAQ X