MCPcopy
hub / github.com/localtunnel/server / new_client

Function new_client

server.js:110–140  ·  view source on GitHub ↗
(id, opt, cb)

Source from the content-addressed store, hash-verified

108}
109
110function new_client(id, opt, cb) {
111
112 // can't ask for id already is use
113 // TODO check this new id again
114 if (clients[id]) {
115 id = rand_id();
116 }
117
118 var popt = {
119 id: id,
120 max_tcp_sockets: opt.max_tcp_sockets
121 };
122
123 var client = Proxy(popt, function(err, info) {
124 if (err) {
125 return cb(err);
126 }
127
128 ++stats.tunnels;
129 clients[id] = client;
130
131 info.id = id;
132
133 cb(err, info);
134 });
135
136 client.on('end', function() {
137 --stats.tunnels;
138 delete clients[id];
139 });
140}
141
142module.exports = function(opt) {
143 opt = opt || {};

Callers 1

server.jsFile · 0.85

Calls 1

ProxyFunction · 0.85

Tested by

no test coverage detected