From 550e301083fa4d38f1c1d0cb4162a9c92c67eb44 Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Sun, 6 Jul 2014 01:01:28 -0500 Subject: [PATCH] Remove pooled client example --- examples/pooled_client.js | 60 --------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 examples/pooled_client.js diff --git a/examples/pooled_client.js b/examples/pooled_client.js deleted file mode 100644 index a0b04dc..0000000 --- a/examples/pooled_client.js +++ /dev/null @@ -1,60 +0,0 @@ -var Logger = require('bunyan'); - -var ldap = require('../lib/index'); - - -/// -// Run the "inmemory.js" server in the same directory -/// - -function ifError(err) { - if (err) { - console.error(err.stack); - process.exit(1); - } -} - -var LOG = new Logger({ - name: 'ldapjs', - stream: process.stderr, - level: (process.env.LOG_LEVEL || 'info'), - serializers: Logger.stdSerializers -}); -var MAX_CONNS = process.env.LDAP_MAX_CONNS || 10; - -var client = ldap.createClient({ - url: 'ldap://localhost:1389', - maxConnections: MAX_CONNS, - log: LOG -}); - -client.bind('cn=root', 'secret', function (err) { - ifError(err); - - client.add('o=smartdc', {o: 'smartdc'}, function (err) { - ifError(err); - - var finished = 0; - for (var i = 0; i < MAX_CONNS; i++) { - client.search('o=smartdc', function (err, res) { - ifError(err); - res.on('end', function () { - if (++finished === (MAX_CONNS - 1)) { - console.error('Go kill the LDAP server and restart it') - setTimeout(function () { - console.log('readding suffix'); - client.add('o=smartdc', {o: 'smartdc'}, function (err) { - ifError(err); - client.unbind(function () { - console.log('All done'); - process.exit(0); - }); - }); - }, 15000); - } - }); - }); - } - }); - -});