Commit Graph

43 Commits

Author SHA1 Message Date
Patrick Mooney abdd4890e5 Move client.connect into public API
In cases where a reconnect-enabled client has been manually disconnected
via unbind, it may be desirable to initiate a reconnect without
incurring other client actions.
2014-07-18 10:29:46 -05:00
Patrick Mooney 59bebe537b Make Attribute detection more strict
The old Attribute.isAttribute would allow objects lacking the toBer
method to be attached to Change objects.  This would result in errors
during serialization.

With the stricter Attribute detection, it's necessary to convert
Attribute-like objects containing type (string) and vals (array)
properties into real Attribute objects.  This precise detection is
necessary to avoid falling back to the object-keys-into-attributes

That other logic which will turn a well structured Attribute-like object
such as this:

  { type: 'valid', vals: ['something'] }

... and turn it into something broken like this:

  [
    { type: 'type', vals: ['valid'] },
    { type: 'vals', vals: ['something'] }
  ]
2014-07-17 13:33:02 -05:00
Patrick Mooney 2939fa1fad Improve client request state tracking
- Handle abandoned requests properly
- Re-enable client abandon test
- Report client idleness correctly (even after abandons)

Fix mcavage/node-ldapjs#211
2014-07-09 13:40:17 -05:00
Patrick Mooney 6607d83b86 Add automatic bind support to client
The pooled client would automatically bind when initializing connections
if bindDN and bindCredentials were passed to during construction.
This convenience should be supported in the plain client too.
2014-07-08 21:44:01 -05:00
Patrick Mooney aed6d2b043 Add optional error arg to client destroy event 2014-06-27 17:28:04 -05:00
Patrick Mooney 4bd454e608 Fix client initiation of multiple reconnect ops
If the client queue was enabled and requests were made during the
reconnect process (but after one unsuccessful connection attempt), they
would spawn concurrent reconnection attempts.
2014-06-27 16:48:13 -05:00
Patrick Mooney c7cd5da208 Improve client reconnect behavior
A client configured to reconnect should do so on socket close unless
unbind was called explicitly.  This covers cases where the connection
undergoes clean but unexpected termination.
2014-06-27 16:15:04 -05:00
Patrick Mooney 3edf9de578 Suppress setup errors after client.destroy
This allows clients to be destroyed during setupError events without
emitting errors from the connect/setup retry loop.
2014-06-26 12:05:34 -05:00
Patrick Mooney 28d3ed86e1 Refine client reconnection logic
- Emit setupError for errors during client setup
- Client accepts more generic options.reconnect
- Fix unbind hang in client.destroy
- Add tests for client reconnect/setup scenarios
2014-06-26 10:11:07 -05:00
Patrick Mooney 9e2bbe1072 Alter client queue parameters and error reporting
- Use 'queueDisable' as option for disabling client RequestQueue
- Throw more meaningful ConnectionError when enqueue fails
2014-06-25 14:38:26 -05:00
Patrick Mooney b49c2efed2 Fix socket close event handling in node.js 0.11.x
Fix mcavage/node-ldapjs#205
2014-06-24 18:41:11 -05:00
Patrick Mooney ea96468602 Use proper Change object detection in client 2014-06-24 17:43:25 -05:00
Patrick Mooney a0fd56d7b3 Fix reconnect abort logic on client.destroy() 2014-06-24 13:25:21 -05:00
Patrick Mooney 41f99c5b1a Merge pfmooney/gh-202
Fix mcavage/node-ldapjs#202
2014-06-24 11:06:09 -05:00
Patrick Mooney acfaa69a07 Fix client RequestQueue
- Reference documented queue parameters
- Add freeze/thaw methods
2014-06-24 11:04:23 -05:00
Patrick Mooney 3b101a7b2f Cease reconnection when client.destroy is called 2014-06-24 05:45:06 -05:00
Patrick Mooney 00956eaae5 Add ducktyping Filter.isFilter method
This should make some headway in avoiding instanceof pitfalls when
dealing with Filter objects.

Fix mcavage/node-ldapjs#123
2014-06-23 18:09:56 -05:00
Patrick Mooney 72bfb9b0f7 Major overhaul of client connection logic
- Remove PooledClient
- Add reconnect functionality to client
- Add 'idle' client event and options
2014-06-23 16:15:52 -05:00
Patrick Mooney f213b3e9a2 Allow configuration of derefAliases client option
Fix mcavage/node-ldapjs#134
2014-06-16 10:07:55 -05:00
Patrick Mooney d20308265a Circumvent lack of 'close' event for tls sockets
It appears that in node.js (at least recent versions), the 'close' event
is not emitted by TLS sockets.  The CleartextStream class specifies that
the 'close' event is optional, so such operation is allowed.  In order
to compensate, the event can be trapped at the raw net.socket instead.

Fix mcavage/node-ldapjs#161
2014-01-23 10:06:40 -06:00
Patrick Mooney 7bacfb676e Merge from pfmooney/client-pool-events
Fix mcavage/node-ldapjs#162
2014-01-17 15:33:11 -06:00
Patrick Mooney 6b7906ce99 Fix error event handling for pooled clients
Do not emit error events if no listeners are present
2014-01-17 10:47:51 -06:00
Gonzalo Huerta-Canepa 737009ee15 Modified client to allow buffer as a value for exop 2014-01-03 12:58:20 +00:00
Patrick Mooney dfbb6031c6 Merge client-pool-events from pfmooney/node-ldapjs
Fix mcavage/node-ldapjs#87
2013-11-28 14:09:28 -06:00
Patrick Mooney f5ba81dc38 Minor update to ClientPool event pass-through
- Allow event pass-through when performing ClientPool.bind
- Rename createPool parameter for better readability
- Fix jsstyle error
2013-11-28 14:08:17 -06:00
Patrick Mooney ebcba1205d Fix unhandled error during client connection
Client actions utilizing an EventEmitter may generate unhandled errors,
especially during initial connection.  Tracking whether the emitter has
been sent via callback is critical for proper routing of such errors.

Fix mcavage/node-ldapjs#144
2013-10-30 18:24:37 -05:00
Mark Cavage aa633dfd20 support extensible matching of caseIgnore and caseIgnoreSubstrings 2013-10-28 21:12:12 +00:00
Patrick Mooney e03d40957e Fix some ClientPool event handling
Emit connectTimeout and error events from ClientPool as Client would.
2013-10-24 21:04:50 -05:00
Pedro Palazón Candel a796c3efbf remove listeners on the right object (s/client/res/) 2013-04-30 21:16:45 +03:00
José F. Romaniello 0bd66caae9 Fixes #127 - socket is closed issue with pools 2013-04-10 10:17:23 -03:00
Tobias Muellerleile 4708b61cf4 Allow changing TLS connection options in client 2013-03-15 13:23:43 +01:00
Rob Gulewich f52a29e24c GH-118: "failed to instantiate provider" warnings in console on SmartOS 2013-02-25 21:11:52 -08:00
Mark Cavage 2579c251fb lint/style cleanup and build support updates 2012-09-20 19:38:46 +00:00
Jason Pincin 4de2aa3ed2 client-side support for paged search
Re-applied paged search work by thomasv, without introducing logging
changes.
2012-09-19 16:39:31 -04:00
Kevin Chan 6c7e33763a option.maxConnections of 1 should not create a ClientPool 2012-08-03 15:53:25 -07:00
Pedro P. Candel 2a30dee86b Fixes mcavage/node-ldapjs#83: "ReferenceError: removeAllListeners is not defined" 2012-07-13 16:01:38 +02:00
Mark Cavage 9d984b72fc 0.5.2 broke pooled SSL 2012-07-10 22:40:34 +00:00
Mark Cavage 0da050009b Bad event handling, and working with node 0.8 2012-07-09 13:00:51 +00:00
Mark Cavage fd9d713cdc Fix client memory leaks 2012-07-09 12:23:53 +00:00
Mark Cavage e378ae8474 use connect() instead of createConnection() as the tls api does not have createConnection 2012-04-27 11:02:49 -07:00
Mark Cavage 15413542c9 purge reference to generic-pool 2012-04-26 20:53:23 -07:00
Mark Cavage 3bcb74aa66 GH-72 s/debug/trace/g in client 2012-04-26 20:47:03 -07:00
Mark Cavage 59ea20ffa2 Client refactor, with pooled client (minor lint cleanup as well) 2012-04-26 20:23:43 -07:00