[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/excorporate 4253da4 84/93: Excorporate: Add timeout for
From: |
Stefan Monnier |
Subject: |
[elpa] externals/excorporate 4253da4 84/93: Excorporate: Add timeout for synchronous operations |
Date: |
Sun, 29 Nov 2020 15:43:14 -0500 (EST) |
branch: externals/excorporate
commit 4253da4afaff95ab8e5087a1350a3aaf242069bd
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Excorporate: Add timeout for synchronous operations
* excorporate.el (exco--server-timeout): New variable.
(exco-operate-synchronously): Use exco--server-timeout.
(exco-organizer-smtp-email-address): Likewise. Document
synchronous operation.
---
excorporate.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/excorporate.el b/excorporate.el
index 84c404c..b068121 100644
--- a/excorporate.el
+++ b/excorporate.el
@@ -137,6 +137,9 @@ state machine represents a service connection.")
(defvar exco--connection-identifiers nil
"An ordered list of connection identifiers.")
+(defvar exco--server-timeout 5
+ "The timeout in seconds to wait for a synchronous server response.")
+
(defun exco--parse-xml-in-current-buffer ()
"Decode and parse the XML contents of the current buffer."
(let ((mime-part (mm-dissect-buffer t t)))
@@ -648,7 +651,8 @@ IDENTIFIER is the connection identifier. Execute operation
NAME
with ARGUMENTS then call CALLBACK with two arguments, IDENTIFIER
and the server's response."
(exco--with-fsm identifier
- (fsm-call fsm (list name arguments))))
+ (with-timeout (exco--server-timeout (error "Timed out waiting for server"))
+ (fsm-call fsm (list name arguments)))))
(defun exco-server-version (identifier)
"Return the server version for connection IDENTIFIER, as a string.
@@ -867,7 +871,11 @@ argument ICALENDAR-TEXT."
"Return the organizer's SMTP email address as a string.
IDENTIFIER is the connection identifier to use to resolve
ORGANIZER-STRUCTURE to the returned value. ORGANIZER-STRUCTURE
-should be treated as opaque."
+should be treated as opaque.
+
+This function queries the server synchronously. It times out and
+returns nil if the server does not respond in under
+`exco--server-timeout' seconds."
(let* ((wrapped (list (list organizer-structure)))
(routing-type
(exco-extract-value '(Organizer Mailbox RoutingType) wrapped))
@@ -883,10 +891,11 @@ should be treated as opaque."
Mailbox
EmailAddress)
(with-timeout
- (2 (progn
- (message (concat "exco-organizer-smtp-email-address:"
- " Server did not respond in time"))
- nil))
+ (exco--server-timeout
+ (progn
+ (message (concat "exco-organizer-smtp-email-address:"
+ " Server did not respond in time"))
+ nil))
(exco-operate-synchronously identifier
"ResolveNames"
`(((UnresolvedEntry . ,email-address))
- [elpa] externals/excorporate cee32a6 65/93: Excorporate: Add support for synchronous operations, (continued)
- [elpa] externals/excorporate cee32a6 65/93: Excorporate: Add support for synchronous operations, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 166b417 72/93: Excorporate: Add an organizer resolver function, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 936eb4a 61/93: Excorporate: Change identifier format in Org buffer, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate d43e575 58/93: Excorporate: Add an item iteration macro, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 212c8bd 80/93: Excorporate: Rewrite exco-org functions for Org 9.1, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 24a625f 86/93: Excorporate: Add an operation arity function, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 23d19b3 79/93: Excorporate: Document API usage in manual, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate bf88ded 83/93: Excorporate: Add more API usage examples to manual, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate c72216a 92/93: Excorporate: Bump version to 0.9.1, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 98a5284 82/93: Excorporate: Do not explicitly require Org package, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 4253da4 84/93: Excorporate: Add timeout for synchronous operations,
Stefan Monnier <=
- [elpa] externals/excorporate 29bef79 87/93: Excorporate: Bump soap-client required version to 3.2.0, Stefan Monnier, 2020/11/29
- [elpa] externals/excorporate 4fb4450 93/93: * .gitignore: New file, Stefan Monnier, 2020/11/29