+
    4O|j‚O  ã                  ó
  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
Ht ^ RIHtHt ^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ^ R	IHtHtHt ^ R
IHt ^ RIHt ^ RI H!t! ^ RI"H#t# ^ RI$H%t% ]	'       d   ^ RI&H't'H(t(H)t) ^ RI*H+t+ ^ RI,H-t- Rt.R R lt/R R lt0 ! R R4      t1 ! R R]14      t2 ! R R]14      t3 ! R R]14      t4]5! 4       t6R R  lt7R! R" lt8R# R$ lt9R% R& lt:].'       d   ]Pv                  ! ]:4       R# R# )'z9Class to monitor a MongoDB server on a background thread.)ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚOptional)ÚcommonÚperiodic_executor)ÚMovingMinimum)ÚNetworkTimeoutÚ_OperationCancelled)ÚHello)Ú_create_lock)Ú_SDAM_LOGGERÚ
_debug_logÚ_SDAMStatusMessage)Ú_shutdown_executors)Ú_is_faas)ÚMovingAverage)ÚServerDescription)Ú_SrvResolver)Ú
ConnectionÚPoolÚ_CancellationContext)ÚTopologySettings)ÚTopologyTc               ó    € V ^8„  d   QhRRRR/# )é   ÚerrorÚ	ExceptionÚreturnÚNone© )Úformats   "ÚTC:\Users\alokc\chatbot\backend\venv\Lib\site-packages\pymongo/synchronous/monitor.pyÚ__annotate__r#   2   s   € ÷ ñ �Yð  4ñ ó    c                ó0   € RV n         RV n        RV n        R# )z'PYTHON-2433 Clear error traceback info.N)Ú__traceback__Ú__context__Ú	__cause__©r   s   &r"   Ú	_sanitizer*   2   s   € à€EÔØ€EÔØ€E†Or$   c               ó    € V ^8„  d   QhRRRR/# )r   ÚstartÚfloatr   r    )r!   s   "r"   r#   r#   9   s   € ÷ .ñ .˜uð .¨ñ .r$   c                óN   € \        R\        P                  ! 4       V ,
          4      # )zˆReturn the duration since the given start time.

Accounts for buggy platforms where time.monotonic() is not monotonic.
See PYTHON-4600.
g        )ÚmaxÚtimeÚ	monotonic)r,   s   &r"   Ú_monotonic_durationr2   9   s   € ô ˆs”D—N’NÓ$ uÕ,Ó-Ð-r$   c                  ó^   € ] tR t^BtR R ltR R ltR R ltR R ltR	 R
 ltR R lt	Rt
R# )ÚMonitorBasec               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Útopologyr   ÚnameÚstrÚintervalÚintÚmin_intervalr-   r    )r!   s   "r"   r#   ÚMonitorBase.__annotate__C   s)   € ÷  ñ   ð  °ð  Àð  ÐSXñ  r$   c                óø   a€ R V3R llp\         P                  ! W4WRR7      pW`n        RR V3R lllp\        P                  ! WP
                  4      o\        P                  ! W4      V n        \        V 4       R# )z�Base class to do periodic work on a background thread.

The background thread is signaled to stop when the Topology or
this instance is freed.
c               ó   € V ^8„  d   QhRR/# )r   r   Úboolr    )r!   s   "r"   r#   Ú*MonitorBase.__init__.<locals>.__annotate__L   s   € ÷ 	ñ 	˜ñ 	r$   c                 óB   <€ S! 4       p V f   R# V P                  4        R# )NFT)Ú_run)ÚmonitorÚself_refs    €r"   ÚtargetÚ$MonitorBase.__init__.<locals>.targetL   s   ø€ Ù“jˆGØŠÙØ�L‰LŒNÙr$   )r9   r;   rE   r7   Nc               ó    € V ^8„  d   QhRRRR/# )r   ÚdummyzOptional[Topology]r   r   r    )r!   s   "r"   r#   r@   Y   s   € ÷ 	(ñ 	(Ð#5ð 	(Àñ 	(r$   c                óJ   <€ S! 4       pV'       d   VP                  4        R # R # ©N©Úgc_safe_close)rH   rC   rD   s   & €r"   Ú_on_topology_gcÚ-MonitorBase.__init__.<locals>._on_topology_gcY   s    ø€ ñ “jˆGßØ×%Ñ%Ö'ñ r$   rJ   )	r   ÚPeriodicExecutorÚ	_executorÚweakrefÚrefÚcloseÚproxyÚ	_topologyÚ	_register)	Úselfr6   r7   r9   r;   rE   ÚexecutorrM   rD   s	   &&&&&   @r"   Ú__init__ÚMonitorBase.__init__C   s`   ø€ ÷	ð 	ô %×5Ò5ØÀô
ˆð "Œ÷	(ò 	(ô —;’;˜t§^¡^Ó4ˆÜ Ÿš xÓAˆŒÜ�$Žr$   c               ó   € V ^8„  d   QhRR/# ©r   r   r   r    )r!   s   "r"   r#   r<   e   s   € ÷ ñ �dñ r$   c                ó:   € V P                   P                  4        R# )zKStart monitoring, or restart after a fork.

Multiple calls have no effect.
N)rP   Úopen©rW   s   &r"   r^   ÚMonitorBase.opene   s   € ð
 	�‰×ÑÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r<   l   s   € ÷ ñ ˜tñ r$   c                ó:   € V P                   P                  4        R# )zGC safe close.N)rP   rS   r_   s   &r"   rL   ÚMonitorBase.gc_safe_closel   s   € à�‰×ÑÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r<   p   s   € ÷ ñ �tñ r$   c                ó&   € V P                  4        R# )zGClose and stop monitoring.

open() restarts the monitor after closing.
NrK   r_   s   &r"   rS   ÚMonitorBase.closep   s   € ð
 	×ÑÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r<   w   s   € ÷ ñ �dñ r$   c                ó:   € V P                   P                  4        R# )zWait for the monitor to stop.N)rP   Újoinr_   s   &r"   ri   ÚMonitorBase.joinw   ó   € à�‰×ÑÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r<   {   s   € ÷ ñ ˜tñ r$   c                ó:   € V P                   P                  4        R# )z)If the monitor is sleeping, wake it soon.N)rP   Úwaker_   s   &r"   Úrequest_checkÚMonitorBase.request_check{   rk   r$   )rP   rU   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rY   r^   rL   rS   ri   ro   Ú__static_attributes__r    r$   r"   r4   r4   B   s&   † õ õDõõõ÷ñ r$   r4   c                  ó¦   a € ] tR t^€tR V 3R lltR R ltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltR R ltR R ltRtV ;t# )ÚMonitorc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Úserver_descriptionr   r6   r   Úpoolr   Útopology_settingsr   r    )r!   s   "r"   r#   ÚMonitor.__annotate__�   s2   € ÷ &*ñ &*à-ð&*ð ð&*ð ð	&*ð
 ,ñ&*r$   c                ó.  <€ \         SV `  VRVP                  \        P                  4       Wn        W0n        W@n        V P                  P                  P                  V n
        V P                  RJ;'       d    V P                  P                  V n        RV n        RV n        \        VVVP!                  VP"                  4      4      V n        VP&                  R8X  d
   RV n        R# VP&                  R8X  d
   RV n        R# \+        4       '       * V n        R# )zØClass to monitor a MongoDB server on a background thread.

Pass an initial ServerDescription, a Topology, a Pool, and
TopologySettings.

The Topology is weakly referenced. The Pool must be exclusive to this
Monitor.
Úpymongo_server_monitor_threadNÚstreamTÚpollF)ÚsuperrY   Úheartbeat_frequencyr   ÚMIN_HEARTBEAT_INTERVALÚ_server_descriptionÚ_poolÚ	_settingsÚ_pool_optionsÚ_event_listenersÚ
_listenersÚenabled_for_server_heartbeatÚ_publishÚ_cancel_contextÚ_conn_idÚ_RttMonitorÚ_create_pool_for_monitorÚaddressÚ_rtt_monitorÚserver_monitoring_modeÚ_streamr   )rW   ry   r6   rz   r{   Ú	__class__s   &&&&&€r"   rY   ÚMonitor.__init__�   sã   ø€ ô 	‰ÑØØ+Ø×1Ñ1Ü×)Ñ)ô		
ð $6Ô ØŒ
Ø*ŒØŸ.™.×6Ñ6×GÑGˆŒØŸ™¨tÐ3×dÐd¸¿¹×8dÑ8dˆŒØ?CˆÔØ'+ˆŒÜ'ØØØ×-Ñ-Ð.@×.HÑ.HÓIó
ˆÔð
 ×3Ñ3°xÔ?ØˆDŽLØ×5Ñ5¸Ô?Ø ˆDŽLä'›zœ>ˆDŽLr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   ©   s   € ÷ ñ ˜dñ r$   c                óR   € V P                   pV'       d   VP                  4        R# R# )ztCancel any concurrent hello check.

Note: this is called from a weakref.proxy callback and MUST NOT take
any locks.
N)rŒ   Úcancel)rW   Úcontexts   & r"   Úcancel_checkÚMonitor.cancel_check©   s#   € ð ×&Ñ&ˆßð �N‰NÖñ	 r$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   ¶   s   € ÷ &ñ & Dñ &r$   c                óª   € V P                   P                  4        V P                  P                  '       d   V P                   P	                  4        R# R# )z1Start an _RttMonitor that periodically runs ping.N)r‘   r^   rP   Ú_stoppedrS   r_   s   &r"   Ú_start_rtt_monitorÚMonitor._start_rtt_monitor¶   s=   € ð
 	×Ñ×ÑÔ Ø�>‰>×"×"Ð"Ø×Ñ×#Ñ#Ö%ñ #r$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   ¿   s   € ÷ ñ ˜tñ r$   c                	óŽ   € V P                   P                  4        V P                  P                  4        V P	                  4        R # rJ   )rP   rS   r‘   rL   rš   r_   s   &r"   rL   ÚMonitor.gc_safe_close¿   s0   € Ø�‰×ÑÔØ×Ñ×'Ñ'Ô)Ø×ÑÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   Ä   s   € ÷ `ñ `�dñ `r$   c                	ó˜   € \         P                  ! V P                  P                  4       V P                  P                  4       R R7       R# )T)Úreturn_exceptionsN)ÚasyncioÚgatherrP   ri   r‘   r_   s   &r"   ri   ÚMonitor.joinÄ   s/   € Ü�Š�t—~‘~×*Ñ*Ó,¨d×.?Ñ.?×.DÑ.DÓ.FÐZ^×_r$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   Ç   s   € ÷ !ñ !�tñ !r$   c                	óz   € V P                  4        V P                  P                  4        V P                  4        R # rJ   )rL   r‘   rS   Ú_reset_connectionr_   s   &r"   rS   ÚMonitor.closeÇ   s.   € Ø×ÑÔØ×Ñ×ÑÔ!ð 	×ÑÖ r$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   Î   s   € ÷ ñ  4ñ r$   c                	ó:   € V P                   P                  4        R # rJ   )r…   Úresetr_   s   &r"   r¬   ÚMonitor._reset_connectionÎ   s   € à�
‰
×ÑÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r|   Ò   s   € ÷ (*ñ (*�dñ (*r$   c                	ó  €  V P                   p V P                  4       V n         T P                  P                  T P                   T P                   P                  \        T P                   P                  \         4      R7       T P"                  '       dc   T P                   P                  '       dG   T P                   P$                  '       d+   T P'                  4        T P                  P                  4        T P                   P                  '       d-   TP                  '       d   T P                  P                  4        T P                  P                  '       d   T P                  P                  4        R# R#   \         d¡   p\        T4       \	        T P                   P
                  TR 7      T n         TP                  '       d   T P                  P                  4         Rp?T P                  P                  '       d   T P                  P                  4        R# R# Rp?ii ; i  \(         d    T P                  4         ELi ; i  T P                  P                  '       d   T P                  P                  4        i i ; i)r)   N)Ú
reset_poolÚinterrupt_connections)r„   Ú_check_serverr
   r*   r   r�   Úis_server_type_knownrP   Ú
skip_sleeprž   r‘   rS   rU   Ú	on_changer   Ú
isinstancer	   r“   Útopology_versionrŸ   ÚReferenceError)rW   Úprev_sdÚexcs   &  r"   rB   ÚMonitor._runÒ   sÙ  € ð'	*Ø×.Ñ.ˆGðØ+/×+=Ñ+=Ó+?�Ô(ð �N‰N×$Ñ$Ø×(Ñ(Ø×3Ñ3×9Ñ9Ü&0°×1IÑ1I×1OÑ1OÔQ_Ó&`ð %ô ð �|�|ˆ|Ø×(Ñ(×=×=Ð=Ø×,Ñ,×=×=Ð=à×'Ñ'Ô)à—‘×)Ñ)Ô+à×'Ñ'×-×-Ð-°'×2N×2NÐ2Nà—‘×)Ñ)Ô+ð
 �~‰~×&×&Ð&Ø×!Ñ!×'Ñ'Ö)ñ 'øôE 'ô 
Ü˜#”ä+<Ø×,Ñ,×4Ñ4¸Cô,�Ô(ð ×/×/Ð/ð —N‘N×-Ñ-Ô/Ûð0 �~‰~×&×&Ð&Ø×!Ñ!×'Ñ'Ö)ñ 'ûðE
ûô< ô 	à�J‰J�Lð	ûð �~‰~×&×&Ð&Ø×!Ñ!×'Ñ'Õ)ð 'úsf   ‚H& �E8 ¤BH& Â0H& ÃAH& ÄH& Ä$H& Å8H#ÆAHÇ H& ÈH#È#H& È&IÉI ÉIÉI É9Jc               ó   € V ^8„  d   QhRR/# ©r   r   r   r    )r!   s   "r"   r#   r|   ü   s   € ÷ %;ñ %;Ð0ñ %;r$   c                ó–  € RV n         \        P                  ! 4       p V P                  4       #   \         d    h \
         Ed„   p\        T4       T P                  pTP                  p\        T4      p\        T P                  ;'       d!    TP                  ;'       d    TP                  4      pT P                  '       d-   T P                  f   Q hT P                  P!                  YEY&4       \"        P$                  ! \&        P(                  4      '       dZ   \+        \"        \,        P.                  T P0                  P2                  T^ ,          T^,          TTR,          TT P                   R7	       T P5                  4        \7        T\8        4      '       d   h T P:                  P=                  4        \?        YBR7      u Rp?# Rp?ii ; i)zNCall hello or read the next streaming response.

Returns a ServerDescription.
Néè  )ÚmessageÚ
topologyIdÚ
serverHostÚ
serverPortÚawaitedÚ
durationMSÚfailureÚdriverConnectionIdr)   ) r�   r0   r1   Ú_check_oncer¼   r   r*   r„   r�   r2   r?   r“   r·   r»   r‹   r‰   Úpublish_server_heartbeat_failedr   ÚisEnabledForÚloggingÚDEBUGr   r   ÚHEARTBEAT_FAILrU   Ú_topology_idr¬   rº   r
   r‘   r°   r   )rW   r,   r   Úsdr�   ÚdurationrÈ   s   &      r"   r¶   ÚMonitor._check_serverü   sX  € ð
 ˆŒÜ—’Ó ˆð	;Ø×#Ñ#Ó%Ð%øÜô 	ØÜõ 	;Ü�eÔØ×)Ñ)ˆBØ—j‘jˆGÜ*¨5Ó1ˆHÜ˜4Ÿ<™<×[Ð[¨B×,CÑ,C×[Ð[È×H[ÑH[Ó\ˆGØ�}�}ˆ}Ø—‘Ò2Ð2Ð2Ø—‘×?Ñ?ÀÐSXÔbÜ×(Ò(¬¯©×7Ò7ÜÜ Ü.×=Ñ=Ø#Ÿ~™~×:Ñ:Ø& q�zØ& q�zØ#Ø'¨$�Ø!Ø'+§}¡}õ
ð ×"Ñ"Ô$Ü˜%Ô!4×5Ò5ØØ×Ñ×#Ñ#Ô%ä$ WÔ:Õ:ûð5	;ús6   ž. ®GÁGÁAGÂ"GÃAGÄB%GÆ=GÇGc               ó   € V ^8„  d   QhRR/# rÁ   r    )r!   s   "r"   r#   r|   #  s   € ÷ ;ñ ;Ð.ñ ;r$   c                óX  € V P                   P                  pV P                   p\        V P                  P                  ;'       d5    V P
                  ;'       d!    VP                  ;'       d    VP                  4      pV P                  '       d,   V P                  f   Q hV P                  P                  W4       V P                  '       d-   V P                  P                  '       d   V P                  4        V P                  P                  4       ;_uu_ 4       p\        P                   ! \"        P$                  4      '       d\   \'        \        \(        P*                  V P,                  P.                  VP0                  VP2                  V^ ,          V^,          VR7       VP4                  V n        VP0                  V n        V P9                  V4      w  rVVP:                  '       g   V P<                  P?                  V4       V P<                  PA                  4       w  rx\C        WWxR7      pV P                  '       d7   V P                  f   Q hV P                  PE                  WWUP:                  4       \        P                   ! \"        P$                  4      '       do   \'        \        \(        PF                  V P,                  P.                  VP0                  VP2                  V^ ,          V^,          VVR,          VPH                  R7
       VuuRRR4       #   + '       g   i     R# ; i)zVA single attempt to call hello.

Returns a ServerDescription, or raises an exception.
N)rÄ   rÅ   rË   ÚserverConnectionIdrÆ   rÇ   rÈ   )Úmin_round_trip_timerÃ   )	rÄ   rÅ   rË   rØ   rÆ   rÇ   rÈ   rÉ   Úreply)%r„   r�   r?   r…   Úconnsr“   r·   r»   r‹   r‰   Ú publish_server_heartbeat_startedrŒ   Ú	cancelledr¬   Úcheckoutr   rÎ   rÏ   rÐ   r   r   ÚHEARTBEAT_STARTrU   rÒ   ÚidÚserver_connection_idÚcancel_contextr�   Ú_check_with_socketÚ	awaitabler‘   Ú
add_sampleÚgetr   Ú"publish_server_heartbeat_succeededÚHEARTBEAT_SUCCESSÚdocument)	rW   r�   rÓ   rÈ   ÚconnÚresponseÚround_trip_timeÚavg_rttÚmin_rtts	   &        r"   rÌ   ÚMonitor._check_once#  sI  € ð
 ×*Ñ*×2Ñ2ˆØ×%Ñ%ˆô Ø�J‰J×Ñ×aÐa §¡×aÐa°"×2IÑ2I×aÐaÈb×NaÑNaó
ˆð �=�=ˆ=Ø—?‘?Ò.Ð.Ð.Ø�O‰O×<Ñ<¸WÔNà××Ð D×$8Ñ$8×$B×$BÐ$BØ×"Ñ"Ô$Ø�Z‰Z× Ñ ×"Ô" dÜ×(Ò(¬¯©×7Ò7ÜÜ Ü.×>Ñ>Ø#Ÿ~™~×:Ñ:Ø'+§w¡wØ'+×'@Ñ'@Ø& q�zØ& q�zØ#õ	ð $(×#6Ñ#6ˆDÔ à ŸG™GˆDŒMØ(,×(?Ñ(?ÀÓ(EÑ%ˆHØ×%×%Ð%Ø×!Ñ!×,Ñ,¨_Ô=à#×0Ñ0×4Ñ4Ó6ÑˆGÜ" 7°gÔ[ˆBØ�}�}ˆ}Ø—‘Ò2Ð2Ð2Ø—‘×BÑBØ¨h×8JÑ8Jôô ×(Ò(¬¯©×7Ò7ÜÜ Ü.×@Ñ@Ø#Ÿ~™~×:Ñ:Ø'+§w¡wØ'+×'@Ñ'@Ø& q�zØ& q�zØ#Ø.°Õ5Ø"×+Ñ+õð ÷Q #×"×"Ó"ús   ÄFLÊA/LÌL)	c               ó    € V ^8„  d   QhRRRR/# )r   rê   r   r   ztuple[Hello, float]r    )r!   s   "r"   r#   r|   `  s   € ÷ "ñ " zð "Ð6Iñ "r$   c                ó¾  € \         P                  ! 4       pVP                  '       d   \        VP	                  4       RR7      pM�V P
                  '       dj   VP                  '       dX   V P                  P                  '       d<   VP                  V P                  P                  V P                  P                  4      pMVP                  RR4      p\        V4      pW43# )zSReturn (Hello, round_trip_time).

Can raise ConnectionFailure or OperationFailure.
T)rä   N)r0   r1   Úmore_to_comer   Ú_next_replyr“   Úperformed_handshaker„   r»   Ú_hellor†   r‚   r2   )rW   rê   r,   rë   rÔ   s   &&   r"   rã   ÚMonitor._check_with_socket`  s§   € ô
 —’Ó ˆØ××Ðä˜T×-Ñ-Ó/¸4Ô@‰Hà�L�LˆL˜T×5×5Ð5¸$×:RÑ:R×:c×:cÐ:cð —{‘{Ø×(Ñ(×9Ñ9Ø—‘×2Ñ2ó‰Hð —{‘{ 4¨Ó.ˆHÜ& uÓ-ˆØÐ!Ð!r$   )	rŒ   r�   r‰   r…   r‹   r‘   r„   r†   r“   )rq   rr   rs   rt   rY   rš   rŸ   rL   ri   rS   r¬   rB   r¶   rÌ   rã   ru   Ú__classcell__©r”   s   @r"   rw   rw   €   sI   ø† ÷&*ð &*õPõ&õõ
`õ!õõ(*õT%;õN;÷z"ó "r$   rw   c                  óF   a € ] tR tRtR V 3R lltR R ltR R ltRtV ;t# )	Ú
SrvMonitorix  c               ó    € V ^8„  d   QhRRRR/# )r   r6   r   r{   r   r    )r!   s   "r"   r#   ÚSrvMonitor.__annotate__y  s   € ÷ .ñ . ð .Ð>Nñ .r$   c                ó`  <€ \         SV `  VR\        P                  VP                  4       W n        V P
                  P                  V n        \        V P
                  P                  \        4      '       g   Q hV P
                  P                  V n        \        P                  ! 4       V n        R# )zClass to poll SRV records on a background thread.

Pass a Topology and a TopologySettings.

The Topology is weakly referenced.
Úpymongo_srv_polling_threadN)r�   rY   r   ÚMIN_SRV_RESCAN_INTERVALr‚   r†   Ú_seedsÚ	_seedlistrº   Úfqdnr8   Ú_fqdnr0   r1   Ú_startup_time)rW   r6   r{   r”   s   &&&€r"   rY   ÚSrvMonitor.__init__y  s   ø€ ô 	‰ÑØØ(Ü×*Ñ*Ø×1Ñ1ô		
ð +ŒØŸ™×.Ñ.ˆŒÜ˜$Ÿ.™.×-Ñ-¬s×3Ò3Ð3Ð3ØŸ.™.×-Ñ-ˆŒ
Ü!Ÿ^š^Ó-ˆÖr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   rü   Œ  s   € ÷ ñ �dñ r$   c                	óL  € \         P                  ! 4       V P                  \        P                  ,           8  d   R # V P                  4       pV'       d/   Wn         V P                  P                  V P                  4       R # R #   \         d    T P                  4         R # i ; irJ   )r0   r1   r  r   rÿ   Ú_get_seedlistr  rU   Úon_srv_updater¼   rS   )rW   Úseedlists   & r"   rB   ÚSrvMonitor._runŒ  su   € ä�>Š>Ó˜d×0Ñ0´6×3QÑ3QÕQÔQÙØ×%Ñ%Ó'ˆßØ%ŒNðØ—‘×,Ñ,¨T¯^©^Ö<ñ øô "ô à—
‘
—ðús   Á%B ÂB#Â"B#c               ó   € V ^8„  d   QhRR/# )r   r   zOptional[list[tuple[str, Any]]]r    )r!   s   "r"   r#   rü   ™  s   € ÷ ñ Ð>ñ r$   c                óÚ  €  \        V P                  V P                  P                  P                  V P                  P
                  4      pVP                  4       w  r#\        V4      ^ 8X  d   \        h V P                  P                  \        V\        P                  4      4       V#   \         d7   pT P                  4        \        \         R\#        T4      R7        Rp?R# Rp?ii ; i)zHPoll SRV records for a seedlist.

Returns a list of ServerDescriptions.
zSRV monitor check failed)rÄ   rÊ   N)r   r  r†   Úpool_optionsÚconnect_timeoutÚsrv_service_nameÚget_hosts_and_min_ttlÚlenr   rP   Úupdate_intervalr/   r   rÿ   ro   r   r   Úrepr)rW   Úresolverr
  Úttlr¾   s   &    r"   r  ÚSrvMonitor._get_seedlist™  s½   € ð
	Ü#Ø—
‘
Ø—‘×+Ñ+×;Ñ;Ø—‘×/Ñ/óˆHð
 %×:Ñ:Ó<‰MˆHÜ�8‹} Ô!ä�ð "ð �N‰N×*Ñ*¬3¨s´F×4RÑ4RÓ+SÔTØˆOøô ô 	ð
 ×ÑÔ Ü”|Ð-GÔQUÐVYÓQZÕ[Ýûð	ús   ‚A1B) Â)C*Â4+C%Ã%C*)r  r  r†   r  )	rq   rr   rs   rt   rY   rB   r  ru   r÷   rø   s   @r"   rú   rú   x  s   ø† ÷.ð .õ&÷ó r$   rú   c                  óv   a € ] tR tRtR V 3R lltR R ltR R ltR R	 ltR
 R ltR R lt	R R lt
RtV ;t# )rŽ   iµ  c               ó$   € V ^8„  d   QhRRRRRR/# )r   r6   r   r{   r   rz   r   r    )r!   s   "r"   r#   Ú_RttMonitor.__annotate__¶  s#   € ÷ $ñ $ ð $Ð>Nð $ÐVZñ $r$   c                óÂ   <€ \         SV `  VRVP                  \        P                  4       W0n        \        4       V n        \        4       V n	        \        4       V n        R# )zLMaintain round trip times for a server.

The Topology is weakly referenced.
Úpymongo_server_rtt_threadN)r�   rY   r‚   r   rƒ   r…   r   Ú_moving_averager   Ú_moving_minr   Ú_lock)rW   r6   r{   rz   r”   s   &&&&€r"   rY   Ú_RttMonitor.__init__¶  sN   ø€ ô
 	‰ÑØØ'Ø×1Ñ1Ü×)Ñ)ô		
ð Œ
Ü,›ˆÔÜ(›?ˆÔÜ!“^ˆŽ
r$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r  Ç  s   € ÷ ñ �tñ r$   c                	óZ   € V P                  4        V P                  P                  4        R # rJ   )rL   r…   r°   r_   s   &r"   rS   Ú_RttMonitor.closeÇ  s    € Ø×ÑÔð 	�
‰
×ÑÖr$   c               ó    € V ^8„  d   QhRRRR/# )r   Úsampler-   r   r   r    )r!   s   "r"   r#   r  Í  s   € ÷ 0ñ 0 ð 0¨4ñ 0r$   c                óÔ   € V P                   ;_uu_ 4        V P                  P                  V4       V P                  P                  V4       RRR4       R#   + '       g   i     R# ; i)zAdd a RTT sample.N)r  r  rå   r  )rW   r%  s   &&r"   rå   Ú_RttMonitor.add_sampleÍ  s?   € à�Z�Z‹ZØ× Ñ ×+Ñ+¨FÔ3Ø×Ñ×'Ñ'¨Ô/÷ �Z�ZŠZús   •7AÁA'	c               ó   € V ^8„  d   QhRR/# )r   r   ztuple[Optional[float], float]r    )r!   s   "r"   r#   r  Ó  s   € ÷ Fñ FÐ2ñ Fr$   c                óÐ   € V P                   ;_uu_ 4        V P                  P                  4       V P                  P                  4       3uuRRR4       #   + '       g   i     R# ; i)zBGet the calculated average, or None if no samples yet and the min.N)r  r  ræ   r  r_   s   &r"   ræ   Ú_RttMonitor.getÓ  s=   € à�Z�Z‹ZØ×'Ñ'×+Ñ+Ó-¨t×/?Ñ/?×/CÑ/CÓ/EÐE÷ �Z�Z‹Zús   •4AÁA%	c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r  Ø  s   € ÷ %ñ %�tñ %r$   c                óÐ   € V P                   ;_uu_ 4        V P                  P                  4        V P                  P                  4        RRR4       R#   + '       g   i     R# ; i)zReset the average RTT.N)r  r  r°   r  r_   s   &r"   r°   Ú_RttMonitor.resetØ  s;   € à�Z�Z‹ZØ× Ñ ×&Ñ&Ô(Ø×Ñ×"Ñ"Ô$÷ �Z�ZŠZús   •5AÁA%	c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r  Þ  s   € ÷ ñ �dñ r$   c                	óÜ   €  V P                  4       pV P                  V4       R #   \         d    T P                  4         R # \         d    T P
                  P                  4         R # i ; irJ   )Ú_pingrå   r¼   rS   r   r…   r°   )rW   Úrtts   & r"   rB   Ú_RttMonitor._runÞ  sP   € ð
	ð —*‘*“,ˆCØ�O‰O˜CÖ øÜô 	à�J‰J�LÜô 	Ø�J‰J×Ñ×ð	ús   ‚!% ¥A+ÁA+ÁA+Á*A+c               ó   € V ^8„  d   QhRR/# )r   r   r-   r    )r!   s   "r"   r#   r  ë  s   € ÷ .ñ .�uñ .r$   c                ó2  € V P                   P                  4       ;_uu_ 4       pV P                  P                  '       d   \	        R4      h\
        P                  ! 4       pVP                  4        \        V4      uuRRR4       #   + '       g   i     R# ; i)z)Run a "hello" command and return the RTT.z_RttMonitor closedN)	r…   rÞ   rP   rž   r   r0   r1   Úhellor2   )rW   rê   r,   s   &  r"   r0  Ú_RttMonitor._pingë  s_   € à�Z‰Z× Ñ ×"Ô" dØ�~‰~×&×&Ð&ÜÐ 4Ó5Ð5Ü—N’NÓ$ˆEØ�J‰JŒLÜ& uÓ-÷ #×"×"Ó"ús   £ABÂB	)r  r  r  r…   )rq   rr   rs   rt   rY   rS   rå   ræ   r°   rB   r0  ru   r÷   rø   s   @r"   rŽ   rŽ   µ  s1   ø† ÷$ð $õ"õ0õFõ
%õ÷.ó .r$   rŽ   c               ó    € V ^8„  d   QhRRRR/# )r   rC   r4   r   r   r    )r!   s   "r"   r#   r#   û  s   € ÷ ñ �{ð  tñ r$   c                óf   € \         P                  ! V \        4      p\        P	                  V4       R # rJ   )rQ   rR   Ú_unregisterÚ	_MONITORSÚadd)rC   rR   s   & r"   rV   rV   û  s   € Ü
�+Š+�gœ{Ó
+€CÜ‡M�M�#Ör$   c               ó    € V ^8„  d   QhRRRR/# )r   Úmonitor_refz"weakref.ReferenceType[MonitorBase]r   r   r    )r!   s   "r"   r#   r#      s   € ÷ "ñ "Ð?ð "ÀDñ "r$   c                ó0   € \         P                  V 4       R # rJ   )r:  Úremove)r=  s   &r"   r9  r9     s   € Ü×Ñ�[Ö!r$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r#     s   € ÷ ñ ˜Dñ r$   c                 ó�   € \         f   R # \        \         4      p V  F$  pV! 4       pV'       g   K  VP                  4        K&  	  R pR # rJ   )r:  ÚlistrL   )ÚmonitorsrR   rC   s      r"   Ú_shutdown_monitorsrD    sA   € ÜÒÙô ”I‹€Hó ˆÙ“%ˆß‰7Ø×!Ñ!Ö#ñ ð
 ‚Gr$   c               ó   € V ^8„  d   QhRR/# r\   r    )r!   s   "r"   r#   r#     s   € ÷ ñ ˜Tñ r$   c                 ó^   € \         p V '       d   V ! 4        \        p V '       d
   V ! 4        R # R # rJ   )rD  r   )Úshutdowns    r"   Ú_shutdown_resourcesrH    s!   € ä!€HßÙŒ
Ü"€HßÙŽ
ñ r$   )<Ú__doc__Ú
__future__r   r§   ÚatexitrÏ   r0   rQ   Útypingr   r   r   Úpymongor   r   Úpymongo._csotr   Úpymongo.errorsr	   r
   Úpymongo.hellor   Úpymongo.lockr   Úpymongo.loggerr   r   r   Úpymongo.periodic_executorr   Úpymongo.pool_optionsr   Úpymongo.read_preferencesr   Úpymongo.server_descriptionr   Ú pymongo.synchronous.srv_resolverr   Úpymongo.synchronous.poolr   r   r   Úpymongo.synchronous.settingsr   Úpymongo.synchronous.topologyr   Ú_IS_SYNCr*   r2   r4   rw   rú   rŽ   Úsetr:  rV   r9  rD  rH  Úregisterr    r$   r"   Ú<module>r^     sÓ   ðñ @å "ã Û Û Û Û ß /Ñ /ç -Ý 'ß >Ý Ý %ß GÑ GÝ 9Ý )Ý 2Ý 8Ý 9ç÷ñ õ
 >Ý5à€õõ.÷;ñ ;ô|u"ˆkô u"ôp:�ô :ôz=.�+ô =.ñF ‹E€	õõ
"õõ ÷ Ø
‡O‚OÐ'Ö(ñ r$   