[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e43b040 5/6: Excorporate: Add timeout for synchronous oper
[elpa] master e43b040 5/6: Excorporate: Add timeout for synchronous operations
Fri, 25 Sep 2020 22:32:45 -0400 (EDT)
Author: Thomas Fitzsimmons <firstname.lastname@example.org>
Commit: Thomas Fitzsimmons <email@example.com>
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
packages/excorporate/excorporate.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/packages/excorporate/excorporate.el
index 84c404c..b068121 100644
@@ -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
with ARGUMENTS then call CALLBACK with two arguments, IDENTIFIER
and the server's response."
- (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
(let* ((wrapped (list (list organizer-structure)))
(exco-extract-value '(Organizer Mailbox RoutingType) wrapped))
@@ -883,10 +891,11 @@ should be treated as opaque."
- (2 (progn
- (message (concat "exco-organizer-smtp-email-address:"
- " Server did not respond in time"))
+ (message (concat "exco-organizer-smtp-email-address:"
+ " Server did not respond in time"))
`(((UnresolvedEntry . ,email-address))
- [elpa] master updated (78c650b -> 535349a), Thomas Fitzsimmons, 2020/09/25
- [elpa] master 96b57cf 2/6: Excorporate: Expand responses in API usage examples, Thomas Fitzsimmons, 2020/09/25
- [elpa] master 436b625 3/6: Excorporate: Do not explicitly require Org package, Thomas Fitzsimmons, 2020/09/25
- [elpa] master 2fe5e56 1/6: Excorporate: Rewrite exco-org functions for Org 9.1, Thomas Fitzsimmons, 2020/09/25
- [elpa] master 4adac33 4/6: Excorporate: Add more API usage examples to manual, Thomas Fitzsimmons, 2020/09/25
- [elpa] master e43b040 5/6: Excorporate: Add timeout for synchronous operations,
Thomas Fitzsimmons <=
- [elpa] master 535349a 6/6: Excorporate: Rename a function, Thomas Fitzsimmons, 2020/09/25