-í Û„?csedkZdkZdkZdkZdkZdkZdkZdklZdk l Z l Z dk l Z lZdklZdklZdkZdklZdZdZ!d fd „ƒYZ5d efd „ƒYZFd eiefd„ƒYZ+defd„ƒYZ:defd„ƒYZdS(N(ssmac(s ZRPCErrorsDisconnectedError(s short_reprslog(s Marshaller(strigger(s POSExceptions.replyisDelaycs8!tZdZ')d„Z.d„Z1d„ZRS(sòUsed to delay response to client for synchronous calls When a synchronous call is made and the original handler returns without handling the call, it returns a Delay object that prevents the mainloop from sending a response. cs+)*||_+||_,||_dS(N(smsgidsselfs send_replys return_error(sselfsmsgids send_replys return_error((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys set_sender)s  cs./|i|i|ƒdS(N(sselfs send_replysmsgidsobj(sselfsobj((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysreply.scs=12tdtid|ƒ3|i|id|d ŒdS(NsError raised in delayed methodserrorii(slogszLOGsERRORsexc_infosselfs return_errorsmsgid(sselfsexc_info((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyserror1s(s__name__s __module__s__doc__s set_sendersreplyserror(((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysDelay!s  sMTDelaycs;5tZ7d„Z:d„Z>d„ZBd„ZRS(Ncs78tiƒ|_dS(N(s threadingsEventsselfsready(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys__init__7scs0:;ti||||ƒ<|iiƒdS(N(sDelays set_sendersselfsmsgids send_replys return_errorsreadysset(sselfsmsgids send_replys return_error((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys set_sender:scs*>?|iiƒ@ti||ƒdS(N(sselfsreadyswaitsDelaysreplysobj(sselfsobj((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysreply>scs*BC|iiƒDti||ƒdS(N(sselfsreadyswaitsDelayserrorsexc_info(sselfsexc_info((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyserrorBs(s__name__s __module__s__init__s set_sendersreplyserror(((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysMTDelay5s    s ConnectioncsèFtZdZqseiiZteiiZueii Z |dZ }dZ ‹e d„Z®d„Z±eZ³eie d„Z¶d„Z¾d„ZÃd„ZÇe d „ZÖd „Zàd „Zñd „Züd „Z$d„Z*dd„Z-d„Z3d„Z@d„ZSd„Z \d„Zkd„Z ~d„Z!…d„Z"d„Z#•d„Z$Ÿd„Z%¥d„Z&©d„Z'°dd„Z(¹d „Z)æd!„Z*íd"„Z+öd#d$„Z,RS(%sÇDispatcher for RPC on object on both sides of socket. The connection supports synchronous calls, which expect a return, and asynchronous calls, which do not. It uses the Marshaller class to handle encoding and decoding of method calls and arguments. Marshaller uses pickle to encode arbitrary Python objects. The code here doesn't ever see the wire format. A Connection is designed for use in a multithreaded application, where a synchronous call must block until a response is ready. A socket connection between a client and a server allows either side to invoke methods on the other side. The processes on each end of the socket use a Connection object to manage communication. The Connection deals with decoded RPC messages. They are represented as four-tuples containing: msgid, flags, method name, and a tuple of method arguments. The msgid starts at zero and is incremented by one each time a method call message is sent. Each side of the connection has a separate msgid state. When one side of the connection (the client) calls a method, it sends a message with a new msgid. The other side (the server), replies with a message that has the same msgid, the string ".reply" (the global variable REPLY) as the method name, and the actual return value in the args position. Note that each side of the Connection can initiate a call, in which case it will be the client for that particular call. The protocol also supports asynchronous calls. The client does not wait for a return value for an asynchronous call. The only defined flag is ASYNC. If a method call message has the ASYNC flag set, the server will raise an exception. If a method call raises an Exception, the exception is propagated back to the client via the REPLY message. The client side will raise any exception it receives instead of returning the value to the caller. sZ200sZ201cs5‹Œt|_tƒ|_Žd|_d|_t|_‘t|t i ƒo’d||_ n”d||_ •|i ||ƒœd|_t|_ž|iƒŸh||i<|_¡tiƒ|_¤tiƒ|_¥h|_©d|_ªt|_«|i|ƒ¬|iƒdS(Niszrpc-conn:%s:%ds zrpc-conn:%s(sNonesselfsobjs Marshallersmarshalsclosedsmsgidspeer_protocol_versions isinstancesaddrstypess TupleTypes log_labels_Connection__super_initssocks thr_asyncstriggers_prepare_asyncs_filenos_maps threadingsLocks msgid_locks Conditions replies_condsrepliesswaiting_for_replys delay_sesskeysregister_objects handshake(sselfssocksaddrsobj((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys__init__‹s(          cs!®¯d|ii|ifSdS(Ns<%s %s>(sselfs __class__s__name__saddr(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys__repr__®scs&³´ti|i||d|ƒdS(Nserror(szLOGsLOGsselfs log_labelslevelsmessageserror(sselfsmessageslevelserror((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyslog³scsU¶·|io ¸dSn¹|iiƒºd|_»|iƒ¼|iƒdS(Ni(sselfscloseds_mapsclears close_triggers_Connection__super_close(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysclose¶s     cs.¾À|itj oÁ|iiƒndS(N(sselfstriggersNonesclose(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys close_trigger¾scsÃÄÅ||_dS(s4Register obj as the true object to invoke methods onN(sobjsself(sselfsobj((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysregister_objectÃscs0ÇÓ|i|_Ô|i|p|iƒdS(N(sselfsrecv_handshakes message_inputsmessage_outputsprotosprotocol_version(sselfsproto((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys handshakeÇs csšÖØ|`Ù||_Ú|i|jo |ijno!Û|id|dtiƒn7Ý|idt |ƒdti ƒÞt d|ƒ‚dS(Nsreceived handshake %rslevelsbad handshake %ssbad handshake %r( sselfs message_inputsprotospeer_protocol_versionsoldest_protocol_versionsprotocol_versionslogszLOGsINFOs short_reprsERRORs ZRPCError(sselfsproto((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysrecv_handshakeÖs   '!#cs®àáæ|ii|ƒ\}}}}èto6é|i d|||t |ƒfëdt i ƒnì|t joí|i|||ƒnï|i||||ƒdS(s,Decoding an incoming message and dispatch itsrecv msg: %s, %s, %s, %sslevelN(sselfsmarshalsdecodesmessagesmsgidsflagssnamesargss __debug__slogs short_reprszLOGsTRACEsREPLYs handle_replyshandle_request(sselfsmessagesflagssnamesmsgidsargs((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys message_inputàs! "cs˜ñòto3ó|id||t|ƒfôdtiƒnõ|i i ƒöz*÷||f|i |<ø|i i ƒWdùú|i i ƒXdS(Nsrecv reply: %s, %s, %sslevel(s __debug__sselfslogsmsgidsflagss short_reprsargsszLOGsTRACEs replies_condsacquiresrepliess notifyAllsrelease(sselfsmsgidsflagssargs((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys handle_replyñs c s[üý|i|ƒ o/þd|t|iƒf}ÿt|ƒ‚nto0|id|t |ƒfdt i ƒnt |i|ƒ}y9d|_z||Œ}Wd  d|_XWn” ttfj o  ‚nt tj od}tiƒ}|id||ft id|ƒ|d }|i|||ŒSnX|t@o7|tj o#td |t |ƒfƒ‚nn{to*|id |t |ƒft i ƒnt|tƒo |i||i |iƒn|i ||ƒ |i!o#!|i"|i!ƒ"t|_!ndS( NsInvalid method name: %s on %ss calling %s%ssleveliis%s() raised exception: %sserroris!async method %s returned value %ss %s returns %s(#sselfs check_methodsnamesreprsobjsmsgs ZRPCErrors __debug__slogs short_reprsargsszLOGsDEBUGsgetattrsmethswaiting_for_replysrets SystemExitsKeyboardInterrupts Exceptionssyssexc_infoserrorsINFOs return_errorsmsgidsflagssASYNCsNones isinstancesDelays set_senders send_replys delay_sesskeys _Connection__super_setSessionKey( sselfsmsgidsflagssnamesargssmethsretserrorsmsg((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyshandle_requestüs@     ' *  csQ$%tiƒdtjo&tiƒ‚n'|idƒ(|iƒdS(NisError caught in asyncore(ssyssexc_infos SystemExitsselfs log_errorsclose(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys handle_error$ssNo error message suppliedcs)*+|i|tidtiƒƒdS(Nserror(sselfslogsmsgszLOGsERRORssyssexc_info(sselfsmsg((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys log_error*scs8-/|idƒo 0tSn1t|i|ƒSdS(Ns_(snames startswithsNoneshasattrsselfsobj(sselfsname((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys check_method-s csË34y"5|ii|dt|ƒ}Wn6|iij oj7y8t|ƒ}Wn9:d}nX;t d|ƒ}<|ii|dtt |fƒ}nX=|i |ƒ>|i ƒdS(Nis sCouldn't pickle return %.100s(sselfsmarshalsencodesmsgidsREPLYsretsmsgserrorss short_reprsrs ZRPCErrorserrsmessage_outputspoll(sselfsmsgidsretsrserrsmsg((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys send_reply3s" )cs*@A|t@oB|id|ƒCdSnDt|ƒtij oE||f}nGy(H|i i |dt ||fƒ}WnI|i ij ojJyKt|ƒ}WnLMd}nXNtd|ƒ}O|i i |dt t|fƒ}nXP|i|ƒQ|iƒdS(Ns&Asynchronous call raised exception: %sis sCouldn't pickle error %.100s(sflagssASYNCsselfs log_errorstypes err_valuestypess InstanceTypeserr_typesmarshalsencodesmsgidsREPLYsmsgserrorss short_reprsrs ZRPCErrorserrsmessage_outputspoll(sselfsmsgidsflagsserr_types err_valueserrsrsmsg((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys return_error@s  ( )cs4ST|ioU||_nW|i|ƒdS(N(sselfswaiting_for_replyskeys delay_sesskeys _Connection__super_setSessionKey(sselfskey((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys setSessionKeySs cs½\^|iiƒ_z#`|i}a|id|_Wdbc|iiƒXdto*e|id|||fft i ƒng|i i ||||ƒ}h|i|ƒi|SdS(Nissend msg: %d, %d, %s, ...(sselfs msgid_locksacquiresmsgidsreleases __debug__slogsflagssmethodszLOGsTRACEsmarshalsencodesargssbufsmessage_output(sselfsmethodsargssflagssbufsmsgid((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys send_call\s  csÌkl|iomtƒ‚nn|i||dƒ}o|i|ƒ\}}pt |t i ƒo>t |ƒdjo+t|dƒt ijot|dtƒos|d}t|‚nv|SdS(Nii(sselfsclosedsDisconnectedErrors send_callsmethodsargssmsgidswaitsr_flagssr_argss isinstancestypess TupleTypeslenstypes ClassTypes issubclasss Exceptionsinst(sselfsmethodsargssmsgidsr_argssr_flagssinst((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyscallks W  csY~|io€tƒ‚n|i||dƒ}‚tid|i ƒƒ|SdS(Nif0.01( sselfsclosedsDisconnectedErrors send_callsmethodsargssmsgidsasyncorespolls_map(sselfsmethodsargssmsgid((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys_deferred_call~s  cs„…†|i|ƒ\}}‡t|tiƒo+t|dƒti jot |dt ƒoŠ|d}‹|‚n|SdS(Nii( sselfswaitsmsgidsr_flagssr_argss isinstancestypess TupleTypestypes ClassTypes issubclasss Exceptionsinst(sselfsmsgidsr_flagssinstsr_args((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys_deferred_wait…s D  csG|io‘tƒ‚n’|i||tƒ“|iƒdS(N(sselfsclosedsDisconnectedErrors send_callsmethodsargssASYNCspoll(sselfsmethodsargs((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys callAsyncs cs:•™|ioštƒ‚n›|i||tƒdS(N(sselfsclosedsDisconnectedErrors send_callsmethodsargssASYNC(sselfsmethodsargs((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyscallAsyncNoPoll•s cs&Ÿ d|_¡ti|iƒdS(Ni(sselfs thr_asyncs ThreadedAsyncsregister_loop_callbacks set_async(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys_prepare_asyncŸs cs"¥¦tƒ|_§d|_dS(Ni(striggersselfs thr_async(sselfsmap((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys set_async¥scs&©«|io ¬dSn®dSdS(Nii(sselfs thr_async(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysis_async©s  i cs°±y²|iiƒWn`³tj oQ´|iiƒµtƒ|_¶|djo·|id|dƒnnXdS(Nistryagaini(sselfstriggers pull_triggersOSErrorsclosestryagains _pull_trigger(sselfstryagain((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys _pull_trigger°scsW¹º»to0¼|id||iƒf½dtiƒn¾|iƒo¿|iƒnÃd}Å|i i ƒÆz¿ÇxµÇdoªÈ|i oÉt ƒ‚nÊ|i i|ƒ}Ë|tj oRÌ|i |=Íto0Î|id|t|ƒfÏdtiƒnÐ|SnÑ|iƒoÒ|i idƒnìÔ|i iƒÕzÁÖyo×to*Ø|id||fÙdtiƒnÚti||iƒÛ|djoÜ||7}nWnHÝtij o6}Þ|id |ßdtiƒà|iƒnXWd áâ|i i ƒXq†WWd ãä|i iƒXd S( s,Invoke asyncore mainloop and wait for reply.swait(%d), async=%dslevelf0.001iswait(%d): reply=%sf10.0swait(%d): asyncore.poll(%s)f1.0s$Closing. asyncore.poll() raised %s.N(s __debug__sselfslogsmsgidsis_asyncszLOGsTRACEs _pull_triggersdelays replies_condsacquiresclosedsDisconnectedErrorsrepliessgetsreplysNones short_reprswaitsreleasesasyncorespolls_mapsselectserrorserrsBLATHERsclose(sselfsmsgidserrsdelaysreply((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyswait¹sN        csPæçètoé|idƒnêx"ê|iƒoë|iƒq*WdS(s/Invoke poll() until the output buffer is empty.sflushN(s __debug__sselfslogswritablespoll(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysflushæs  csríîïto'ð|id|iƒdtiƒnñ|iƒoò|iƒnôtid|i ƒdS(s4Invoke asyncore mainloop to get pending message out.spoll(), async=%dslevelf0.0N( s __debug__sselfslogsis_asyncszLOGsTRACEs _pull_triggersasyncorespolls_map(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyspollís  'ic sôö÷øto'ù|id|iƒdtiƒnú|iƒo ûdSn|ig}}g}x||o|i of|i ƒo|ig}n  g} y( t i ||||ƒ\}}}WnK t ij o9}|dtijod}qtn‚n Xd}|oPy|iƒWn5tij o  ‚n!"|iƒnXn#|oP$y%|iƒWn5&tij o '‚n()|iƒnXnqtWdS(s7Invoke mainloop until any pending messages are handled.spending(), async=%dslevelNi(s __debug__sselfslogsis_asyncszLOGsTRACEs_filenosrsr_insx_insclosedswritablesw_insselectstimeoutswsxserrorserrserrnosEINTRshandle_read_eventsasyncoresExitNows handle_errorshandle_write_event( sselfstimeoutserrsr_insx_insrswsxsw_in((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyspendingösD '   (       (-s__name__s __module__s__doc__ssmacsSizedMessageAsyncConnections__init__s_Connection__super_initscloses_Connection__super_closes setSessionKeys _Connection__super_setSessionKeysoldest_protocol_versionsprotocol_versionsNones__repr__s__str__szLOGsBLATHERslogs close_triggersregister_objects handshakesrecv_handshakes message_inputs handle_replyshandle_requests handle_errors log_errors check_methods send_replys return_errors send_callscalls_deferred_calls_deferred_waits callAsyncscallAsyncNoPolls_prepare_asyncs set_asyncsis_asyncs _pull_triggerswaitsflushspollspending(((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys ConnectionFsL+  #       (           -  sManagedServerConnectioncsD+tZdZ,-eiZ.eiZ0d„Z5d„ZRS(s Server-side Connection subclass.cs<01||_2|i|||ƒ3|ii|ƒdS(N(smgrsselfs$_ManagedServerConnection__super_initssocksaddrsobjsnotifyConnected(sselfssocksaddrsobjsmgr((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys__init__0s cs756|iiƒ7|ii|ƒ8|iƒdS(N(sselfsobjsnotifyDisconnectedsmgrs close_conns%_ManagedServerConnection__super_close(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysclose5s(s__name__s __module__s__doc__s Connections__init__s$_ManagedServerConnection__super_initscloses%_ManagedServerConnection__super_close(((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysManagedServerConnection+s    sManagedConnectioncs¤:tZdZ;<eiZ=eiZ?d„Zkd„Zqd„Z td„Z €d„Z „d„Z ‡d„Z ‹d„Z”d „Zšd „ZRS( s Client-side Connection subclass.cs6?@||_A|i|||ƒB|iƒdS(N(smgrsselfs_ManagedConnection__super_initssocksaddrsobjscheck_mgr_async(sselfssocksaddrsobjsmgr((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys__init__?s cs1kl|i|_m|i|_ng|_dS(N(sselfsrecv_handshakes message_inputs queue_outputsmessage_outputs output_queue(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys handshakekscsqr|ii|ƒdS(N(sselfs output_queuesappendsmessage(sselfsmessage((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys queue_outputqscs„tu|`vt||iƒ}wti||ƒx|i|ƒy|i}z|`{x!|D{]}||i|ƒqcWdS(N( sselfsmessage_outputsminsprotosprotocol_versions Connectionsrecv_handshakes output_queuesqueuesmessage(sselfsprotosqueuesmessage((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysrecv_handshakets    cs€‚|`dS(N(sselfstrigger(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys close_trigger€scs „…dS(N((sselfsmap((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys set_async„scs ‡‰dS(N((sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys_prepare_async‡scs€‹Œ|i o |iioWto$|iitj ptd|i‚d|_|ii|_‘dSn’dSdS(Nsmanager (%s) has no triggerii(sselfs thr_asyncsmgrs __debug__striggersNonesAssertionError(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pyscheck_mgr_async‹s .  cs,”–|io —dSn˜|iƒSdS(Ni(sselfs thr_asyncscheck_mgr_async(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysis_async”s  cs'š›|ii|ƒœ|iƒdS(N(sselfsmgrs close_conns_ManagedConnection__super_close(sself((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysclosešs(s__name__s __module__s__doc__s Connections__init__s_ManagedConnection__super_initscloses_ManagedConnection__super_closes handshakes queue_outputsrecv_handshakes close_triggers set_asyncs_prepare_asyncscheck_mgr_asyncsis_async(((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pysManagedConnection:s   ,      (sasyncoreserrnosselectssyss threadingstypess ThreadedAsyncsZEO.zrpcssmacsZEO.zrpc.errors ZRPCErrorsDisconnectedErrors ZEO.zrpc.logs short_reprslogsZEO.zrpc.marshals MarshallersZEO.zrpc.triggerstriggerszLOGsZODBs POSExceptionsREPLYsASYNCsDelaysMTDelaysSizedMessageAsyncConnectionsobjects ConnectionsManagedServerConnectionsManagedConnection(sManagedServerConnectionsasyncoressmacs ConnectionsMTDelaysDisconnectedErrorsREPLYsASYNCs POSExceptionstypesssyss short_reprs ThreadedAsyncslogs threadingserrnosDelays MarshallerstriggersselectsManagedConnectionszLOGs ZRPCError((s;/usr/pkg/lib/python2.2/site-packages/ZEO/zrpc/connection.pys?s*         ÿæ