projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sb-bsd-sockets: Fix error code handling on Windows
[sbcl.git]
/
src
/
code
/
serve-event.lisp
diff --git
a/src/code/serve-event.lisp
b/src/code/serve-event.lisp
index
508d465
..
2faa401
100644
(file)
--- a/
src/code/serve-event.lisp
+++ b/
src/code/serve-event.lisp
@@
-72,6
+72,8
@@
(unless (member direction '(:input :output))
;; FIXME: should be TYPE-ERROR?
(error "Invalid direction ~S, must be either :INPUT or :OUTPUT" direction))
(unless (member direction '(:input :output))
;; FIXME: should be TYPE-ERROR?
(error "Invalid direction ~S, must be either :INPUT or :OUTPUT" direction))
+ (unless (<= 0 fd (1- sb!unix:fd-setsize))
+ (error "Cannot add an FD handler for ~D: not under FD_SETSIZE limit." fd))
(let ((handler (make-handler direction fd function)))
(with-descriptor-handlers
(push handler *descriptor-handlers*))
(let ((handler (make-handler direction fd function)))
(with-descriptor-handlers
(push handler *descriptor-handlers*))
@@
-209,7
+211,8
@@
waiting."
(loop for to-msec = (if (and to-sec to-usec)
(+ (* 1000 to-sec) (truncate to-usec 1000))
-1)
(loop for to-msec = (if (and to-sec to-usec)
(+ (* 1000 to-sec) (truncate to-usec 1000))
-1)
- when (sb!unix:unix-simple-poll fd direction to-msec)
+ when (or #!+win32 (eq direction :output)
+ (sb!unix:unix-simple-poll fd direction to-msec))
do (return-from wait-until-fd-usable t)
else
do (when to-sec (maybe-update-timeout))))))))
do (return-from wait-until-fd-usable t)
else
do (when to-sec (maybe-update-timeout))))))))
@@
-320,7
+323,11
@@
happens. Server returns T if something happened and NIL otherwise. Timeout
(ecase (handler-direction handler)
(:input (sb!unix:fd-isset fd read-fds))
(:output (sb!unix:fd-isset fd write-fds)))))))
(ecase (handler-direction handler)
(:input (sb!unix:fd-isset fd read-fds))
(:output (sb!unix:fd-isset fd write-fds)))))))
- (funcall (handler-function handler)
- (handler-descriptor handler)))
+ (with-simple-restart (remove-fd-handler "Remove ~S" handler)
+ (funcall (handler-function handler)
+ (handler-descriptor handler))
+ (go :next))
+ (remove-fd-handler handler)
+ :next)
t))))))
t))))))