Author: ctian
Date: Thu Jul 15 02:02:17 2010
New Revision: 545
Log:
Server: fix wrong parensises in UDP-EVENT-LOOP
Modified:
usocket/trunk/backend/sbcl.lisp
usocket/trunk/server.lisp
usocket/trunk/usocket.lisp
Modified: usocket/trunk/backend/sbcl.lisp
==============================================================================
--- usocket/trunk/backend/sbcl.lisp (original)
+++ usocket/trunk/backend/sbcl.lisp Thu Jul 15 02:02:17 2010
@@ -38,7 +38,6 @@
(when (= result 0)
(sb-alien:cast buf sb-alien:c-string))))))
-
#+ecl
(progn
#-:wsock
@@ -148,7 +147,6 @@
(when (fdset-fd-isset rfds (sb-bsd-sockets:socket-file-descriptor
(socket sock)))
(setf (state sock) :READ))))))))
-
) ; progn
(defun map-socket-error (sock-err)
@@ -343,7 +341,6 @@
(defmethod get-peer-port ((usocket stream-usocket))
(nth-value 1 (get-peer-name usocket)))
-
(defun get-host-by-address (address)
(with-mapped-conditions ()
(sb-bsd-sockets::host-ent-name
@@ -397,7 +394,6 @@
(setf (state x) :READ))))))))))
) ; progn
-
;;; WAIT-FOR-INPUT support for SBCL on Windows platform (Chun Tian (binghe))
;;; Based on LispWorks version written by Erik Huelsmann.
@@ -499,7 +495,6 @@
(notany #'socket-ready-p sockets))
(defun wait-for-input-internal (wait-list &key timeout)
- (format t "timeout: ~A, ~A~%" timeout (truncate (* 1000000 timeout)))
(when (waiting-required (wait-list-waiters wait-list))
(let ((rv (wait-for-single-object (wait-list-%wait wait-list) (truncate (* 1000000 timeout)))))
(ecase rv
Modified: usocket/trunk/server.lisp
==============================================================================
--- usocket/trunk/server.lisp (original)
+++ usocket/trunk/server.lisp Thu Jul 15 02:02:17 2010
@@ -67,9 +67,9 @@
(error "send error: ~A~%" n))))))
(error "receive error: ~A" n))))
#+scl (when thread:*quitting-lisp* (return))
- #+(and cmu mp) (mp:process-yield))))
- (socket-close socket)
- (values)))
+ #+(and cmu mp) (mp:process-yield)))
+ (socket-close socket)
+ (values))))
(defun default-tcp-handler (stream) ; null
(declare (type stream stream))
Modified: usocket/trunk/usocket.lisp
==============================================================================
--- usocket/trunk/usocket.lisp (original)
+++ usocket/trunk/usocket.lisp Thu Jul 15 02:02:17 2010
@@ -215,10 +215,10 @@
the arguments `socket-connect-args' to `socket-var' and if `stream-var' is
non-nil, bind the associated socket stream to it."
`(with-connected-socket (,socket-var (socket-connect ,@socket-connect-args))
- ,(if (null stream-var)
- `(progn ,@body)
- `(let ((,stream-var (socket-stream ,socket-var)))
- ,@body))))
+ ,(if (null stream-var)
+ `(progn ,@body)
+ `(let ((,stream-var (socket-stream ,socket-var)))
+ ,@body))))
(defmacro with-server-socket ((var server-socket) &body body)
"Bind `server-socket' to `var', ensuring socket destruction on exit.
@@ -227,21 +227,19 @@
The `body' is an implied progn form."
`(with-connected-socket (,var ,server-socket)
- ,@body))
+ ,@body))
(defmacro with-socket-listener ((socket-var &rest socket-listen-args)
&body body)
"Bind the socket resulting from a call to `socket-listen' with arguments
`socket-listen-args' to `socket-var'."
`(with-server-socket (,socket-var (socket-listen ,@socket-listen-args))
- ,@body))
-
+ ,@body))
(defstruct (wait-list (:constructor %make-wait-list))
%wait ;; implementation specific
waiters ;; the list of all usockets
- map ;; maps implementation sockets to usockets
- )
+ map) ;; maps implementation sockets to usockets
;; Implementation specific:
;;
@@ -253,9 +251,8 @@
(let ((wl (%make-wait-list)))
(setf (wait-list-map wl) (make-hash-table))
(%setup-wait-list wl)
- (dolist (x waiters)
- (add-waiter wl x))
- wl))
+ (dolist (x waiters wl)
+ (add-waiter wl x))))
(defun add-waiter (wait-list input)
(setf (gethash (socket input) (wait-list-map wait-list)) input
@@ -276,7 +273,6 @@
(setf (wait-list-waiters wait-list) nil)
(clrhash (wait-list-map wait-list)))
-
(defun wait-for-input (socket-or-sockets &key timeout ready-only)
"Waits for one or more streams to become ready for reading from
the socket. When `timeout' (a non-negative real number) is
@@ -353,7 +349,6 @@
(setf (ldb (byte 8 i) integer)
(aref buffer b)))))
-
(defmacro port-to-octet-buffer (port buffer &key (start 0))
`(integer-to-octet-buffer ,port ,buffer 2 ,start))
@@ -508,9 +503,6 @@
(values secs
(truncate (* fractional sec-frac) 1))))
-
-
-
;;
;; Setting of documentation for backend defined functions
;;