Skip to content

Commit

Permalink
Merge branch '1.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
cvmat committed Jun 28, 2010
2 parents 24b0df4 + 69c6266 commit 978f6b5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
@@ -1,3 +1,15 @@
2010-06-29 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el: Confirm process status for avoiding
dead-lock.
(twittering-oauth-get-token-alist-native): confirm the process
status in order to avoid dead-lock. If the process exited
abnormally, the variable `result' becomes nil.
(twittering-oauth-get-token-alist-curl): likewise.
(twittering-verify-credentials): wait for the process to exit
in order to avoid dead-lock.
(twittering-get-list-index-sync): likewise.

2010-06-13 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el (twittering-write-and-encrypt): fix arguments
Expand Down
51 changes: 40 additions & 11 deletions twittering-mode.el
Expand Up @@ -1152,13 +1152,20 @@ function."
proc
(lambda (&rest args)
(let* ((proc (car args))
(buffer (process-buffer proc)))
(when buffer
(buffer (process-buffer proc))
(status (process-status proc)))
(cond
((not (memq status '(nil closed exit failed signal)))
;; continue
)
(buffer
(when twittering-debug-mode
(with-current-buffer (twittering-debug-buffer)
(insert-buffer-substring buffer)))
(setq result
(twittering-oauth-get-response-alist buffer))))))
(twittering-oauth-get-response-alist buffer)))
(t
(setq result nil))))))
(process-send-string proc request-str)
(while (eq result 'queried)
(sit-for 0.1))
Expand Down Expand Up @@ -1230,13 +1237,20 @@ function."
proc
(lambda (&rest args)
(let* ((proc (car args))
(buffer (process-buffer proc)))
(when buffer
(buffer (process-buffer proc))
(status (process-status proc)))
(cond
((not (memq status '(nil closed exit failed signal)))
;; continue
)
(buffer
(when twittering-debug-mode
(with-current-buffer (twittering-debug-buffer)
(insert-buffer-substring buffer)))
(setq result
(twittering-oauth-get-response-alist buffer))))))
(twittering-oauth-get-response-alist buffer)))
(t
(setq result nil))))))
(while (eq result 'queried)
(sit-for 0.1))
result))))))
Expand Down Expand Up @@ -3140,12 +3154,22 @@ authorized -- The account has been authorized.")
(twittering-call-api
'verify-credentials
`((sentinel . twittering-http-get-verify-credentials-sentinel)))))
(unless proc
(cond
((null proc)
(setq twittering-account-authorization nil)
(message "Authorization for the account \"%s\" failed. Type M-x twit to retry."
(twittering-get-username))
(setq twittering-username nil)
(setq twittering-password nil))))))
(setq twittering-password nil))
(t
(while (and (eq twittering-account-authorization 'queried)
(memq (process-status proc) '(run connect open)))
(sit-for 0.1))
(when (eq twittering-account-authorization 'queried)
(setq twittering-account-authorization nil)
(message "Authorization failed. Type M-x twit to retry.")
(setq twittering-username nil)
(setq twittering-password nil))))))))

(defun twittering-http-get-verify-credentials-sentinel (header-info proc noninteractive &optional suc-msg)
(let ((status-line (cdr (assq 'status-line header-info)))
Expand Down Expand Up @@ -5388,10 +5412,15 @@ variable `twittering-status-format'."

(defun twittering-get-list-index-sync (username)
(setq twittering-list-index-retrieved nil)
(twittering-get-list-index username)
(while (not twittering-list-index-retrieved)
(sit-for 0.1))
(let ((proc (twittering-get-list-index username)))
(when proc
(while (and (not twittering-list-index-retrieved)
(not (memq (process-status proc)
'(exit signal closed failed nil))))
(sit-for 0.1))))
(cond
((null twittering-list-index-retrieved)
nil)
((stringp twittering-list-index-retrieved)
(if (string= "" twittering-list-index-retrieved)
(message "%s does not have a list." username)
Expand Down

0 comments on commit 978f6b5

Please sign in to comment.