7.6.2.7 Autoreconnecting to a Directory Server
This task reconnects to a directory server when network errors are encountered on a connection.
The parameters for this task are as follows:
Name |
Type |
Description |
Optional |
---|---|---|---|
TaskInputConnectionInfo |
ConnectionInfo |
An initialized ConnectionInfo on which an autoreconnect is to be performed. |
No |
The task returns the following results to the caller:
Name |
Type |
Description |
---|---|---|
TaskReturnStatus |
Boolean |
This task returns TRUE if the client successfully reconnects to a directory server. Otherwise, it returns FALSE. |
The task performs the following actions:
Let wasBound be a Boolean set equal to the value of TaskInputConnectionInfo.bindHasHappened.
Set TaskInputConnectionInfo.bindHasHappened to FALSE.
Invoke the Connecting to a Directory Server (section 7.6.2.2) task with the following parameters: TaskInputConnectionInfo is set to the passed-in TaskInputConnectionInfo. If this invocation returns FALSE, then return FALSE from this task.
If wasBound is TRUE, then invoke the Performing an LDAP Bind Against a Directory Server (section 7.6.2.3) task with the following parameters: TaskInputConnectionInfo is set to the passed-in TaskInputConnectionInfo. If this invocation returns an error, then return FALSE from this task.
For each LDAPRequest lrq in TaskInputConnectionInfo.pendingRequestList for which lrq.resultMessages is empty:
Increment lrq.numResends by 1.
If lrq.numResends is greater than 20 or if lrq.requestMessage is a SearchRequest ([RFC2251] section 4.5.1, Search Request) containing the LDAP_SERVER_NOTIFICATION_OID control (section 3.1.1.3.4.1.9, LDAP_SERVER_NOTIFICATION_OID), then construct an LDAPMessage, lm, containing an LDAPResult, lr, representing a response for lrq.requestMessage, indicating that the directory server was unreachable:
Set lm.messageID to lrq.requestMessage.messageID.
Set lr.resultCode to a local implementation-specific error code indicating that the directory server was unreachable, using an error code value reserved for APIs as specified in [RFC2251] section 4.1.10, Result Message.
Note The Microsoft implementation of LDAP client sets the resultCode of LDAPResult to LDAP_SERVER_DOWN (0x51) when the directory server is unreachable ([MS-ERREF] section 2.4, LDAP error to Win32 mapping).
Set lr.errorMessage and lr.matchedDN to a zero-length string.
Insert the LDAPMessage lm into lrq.resultMessages.
Otherwise:
Invoke the Performing an LDAP Operation Against a Directory Server (section 7.6.2.5) task with the following parameters: TaskInputConnectionInfo is the passed-in TaskInputConnectionInfo, and TaskInputRequestMessage is lrq.
If the above invocation returns FALSE, then construct an LDAPMessage, lm, containing an LDAPResult, lr, representing a response for lrq.requestMessage, indicating that the directory server was unreachable:
Set lm.messageID to lrq.requestMessage.messageID.
Set lr.resultCode to a local implementation-specific error code indicating that the directory server was unreachable, using an error code value reserved for APIs as specified in [RFC2251] section 4.1.10, Result Message.
Note The Microsoft implementation of LDAP client sets the resultCode of LDAPResult to LDAP_SERVER_DOWN (0x51) when the directory server is unreachable ([MS-ERREF] section 2.4, LDAP error to Win32 mapping).
Set lr.errorMessage and lr.matchedDN to a zero-length string.
Insert the LDAPMessage lm into lrq.resultMessages.
Return TRUE.