| (function() { |
| var ServiceMap; |
| |
| ServiceMap = (function() { |
| function ServiceMap() { |
| this.remotes = Object.create(null); |
| } |
| |
| ServiceMap.prototype.end = function() { |
| var remote, remoteId, _ref; |
| _ref = this.remotes; |
| for (remoteId in _ref) { |
| remote = _ref[remoteId]; |
| remote.end(); |
| } |
| this.remotes = Object.create(null); |
| }; |
| |
| ServiceMap.prototype.put = function(remoteId, socket) { |
| return this.remotes[remoteId] = socket; |
| }; |
| |
| ServiceMap.prototype.get = function(remoteId) { |
| return this.remotes[remoteId] || null; |
| }; |
| |
| ServiceMap.prototype.remove = function(remoteId) { |
| var remote; |
| if (remote = this.remotes[remoteId]) { |
| delete this.remotes[remoteId]; |
| return remote; |
| } else { |
| return null; |
| } |
| }; |
| |
| return ServiceMap; |
| |
| })(); |
| |
| module.exports = ServiceMap; |
| |
| }).call(this); |