o ö]LbÎ ã@sNddlmZddlmZmZmZmZejZGdd„de ƒZ Gdd„de ƒZ dS)é)Úabsolute_import)ÚhgÚpycompatÚsshpeerÚutilc@s$eZdZdd„Zdd„Zdd„ZdS)ÚconnectionpoolcCs||_tƒ|_dS©N)Ú_repoÚdictÚ_pool)ÚselfÚrepo©rúD/usr/lib/python3/dist-packages/hgext/remotefilelog/connectionpool.pyÚ__init__s zconnectionpool.__init__csÆ|j |¡}|durtƒ}||j|<d}t|ƒdkr;z| ¡}|j}t|tƒr0|j  ¡dur0d}Wn t y:Ynw|durat  |j j i|¡}t |d¡r\G‡fdd„d|jƒ‰ˆ|_t||ƒ}|S)NrÚ_cleanupcs eZdZd‡‡fdd„ Z‡ZS)z"connectionpool.get..mypeerNcs$t |d¡r |j ¡tˆ|ƒ ¡S)NÚpipee)rÚ safehasattrrÚcloseÚsuperr)r Úwarn)Ú __class__Úmypeerrrr1s  z+connectionpool.get..mypeer._cleanupr)Ú__name__Ú __module__Ú __qualname__rÚ __classcell__r©r)rrr0sr)r ÚgetÚlistÚlenÚpopÚpeerÚ isinstanceÚ _sshv1peerÚ _subprocessÚpollÚ IndexErrorrr ÚuirrrÚ connection)r ÚpathÚpathpoolÚconnr"rrrrs.    € ÿ  zconnectionpool.getcCs2t |j¡D]}|D]}| ¡q |dd…=qdSr)rÚ itervaluesr r)r r+r,rrrr?s   ýzconnectionpool.closeN)rrrrrrrrrrrs &rc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) r)cCs||_||_dSr)r r")r Úpoolr"rrrrGs zconnection.__init__cCs|Srr©r rrrÚ __enter__Kszconnection.__enter__cCs$|dur |j |¡dS| ¡dSr)r Úappendr)r ÚtypeÚvalueÚ tracebackrrrÚ__exit__Ns zconnection.__exit__cCs t |jd¡r|j ¡dSdS)NÚcleanup)rrr"r6r/rrrrWsÿzconnection.closeN)rrrrr0r5rrrrrr)Fs  r)N) Ú __future__rÚ mercurialrrrrÚ sshv1peerr$Úobjectrr)rrrrÚs 2