From: Ken K. <key...@KS...> - 2004-05-03 21:55:49
|
Hi Folks, when calling ldap.result(msgid=ldap.RES_ANY) on several outstanding async client requests in python-ldap 2.0.0pre21, I cannot find a way to get the received message ID. In looking through the sources, it appears the information is never preserved. I locally hacked my copy of LDAPObject.c to make ldap.result() return a 3-part tuple of (result_type, result_data, result_msgid), where result_msgid = ldap_msgid(msg) after the msg was determined to be good. I need the message ID to match up the reply with the originating request context. Am I missing something? Is there already a way to retreive the msgid that I missed? Thanks for any info, K^2 |
From: <mi...@st...> - 2004-05-04 07:04:02
|
Ken Key wrote: > > when calling ldap.result(msgid=ldap.RES_ANY) on several > outstanding async client requests in python-ldap 2.0.0pre21, I > cannot find a way to get the received message ID. In current implementation the msgid is not passed to the calling application. > In looking > through the sources, it appears the information is never preserved. > I locally hacked my copy of LDAPObject.c to make ldap.result() > return a 3-part tuple of (result_type, result_data, result_msgid), > where result_msgid = ldap_msgid(msg) after the msg was determined > to be good. Please provide a patch. > I need the message ID to match up the reply with the > originating request context. This would also be very handy for a completely async LDAPObject implementation which dispatches results to calling threads without having to use thread locks around each _ldap call. Ciao, Michael. |
From: Ken K. <key...@KS...> - 2004-05-04 18:00:11
Attachments:
LDAPObject.c-diffs.txt
|
>> In looking >> through the sources, it appears the information is never preserved. >> I locally hacked my copy of LDAPObject.c to make ldap.result() >> return a 3-part tuple of (result_type, result_data, result_msgid), >> where result_msgid = ldap_msgid(msg) after the msg was determined >> to be good. > > Please provide a patch. I've attached the diff below to the change I was testing in Modules/LDAPObject.c. It is not a complete fix, as I still need to go through the rest of the code to change the result() return handling to deal with the 3 element tuple. The hack was just a quick proof of concept change to see if I could get my proxy server to work. I'll work up a more complete patch in a couple of days. Honestly, I half expected this idea to be rejected. Won't changing this return value break any 3rd party code that uses ldap.result() when they crack out the elements of the return tuple? I must confess that I am new to Python (and LDAP), so perhaps I'm asking a stupid question. >> I need the message ID to match up the reply with the >> originating request context. > > This would also be very handy for a completely async LDAPObject > implementation which dispatches results to calling threads without having > to > use thread locks around each _ldap call. I think I follow that, but it's a bit over my head. I'm just looking for a way to lookup the client who's proxy request this reply was for. Regards, K^2 |
From: <mi...@st...> - 2004-05-04 18:13:08
|
Ken Key wrote: > > I've attached the diff below to the change I was testing in > Modules/LDAPObject.c. Thanks a lot. > It is not a complete fix, as I still > need to go through the rest of the code to change the result() > return handling to deal with the 3 element tuple. > [..] > I'll work up a more complete patch in a couple of days. Don't worry. I'll work that out. > Honestly, > I half expected this idea to be rejected. Won't changing this > return value break any 3rd party code that uses ldap.result() > when they crack out the elements of the return tuple? I will probably preserve result() as is and provide a second method result2() or similar with class ldap.ldapobject.LDAPObject which returns the complete 3-tuple. Ciao, Michael. |
From: <mi...@st...> - 2004-05-05 18:04:08
|
Michael Str=F6der wrote: > Ken Key wrote: >=20 >> It is not a complete fix, as I still >> need to go through the rest of the code to change the result() >> return handling to deal with the 3 element tuple. >> [..] >> I'll work up a more complete patch in a couple of days.=20 >=20 > Don't worry. I'll work that out. I've checked in your patch with modifications to ldap.ldapobject (see bel= ow). Modules/: * New method result2() returns 3-tuple containing the msgid of the outstanding operation ldap.ldapobject: * LDAPObject.result2() (see above). LDAPObject.result() uses LDAPObject.result2(). Ciao, Michael. |