Skip to content

Commit

Permalink
Put server exported symbols back to package.lisp
Browse files Browse the repository at this point in the history
  • Loading branch information
binghe committed Oct 26, 2016
2 parents 7ca9064 + f520a8e commit 4d4017a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
6 changes: 5 additions & 1 deletion package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,9 @@

#:insufficient-implementation ; conditions regarding usocket support level
#:unsupported
#:unimplemented))
#:unimplemented

#:socket-server
#:*remote-host*
#:*remote-port*))
) ; unless
11 changes: 2 additions & 9 deletions server.lisp
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
(in-package :usocket)

(eval-when (:compile-toplevel :load-toplevel :execute)
(use-package :portable-threads)

(export '(socket-server
*remote-host*
*remote-port*)))

(defun socket-server (host port function &optional arguments
&key in-new-thread (protocol :stream)
;; for udp
Expand Down Expand Up @@ -36,7 +29,7 @@
:timeout timeout
:max-buffer-size max-buffer-size)))))
(if in-new-thread
(values (spawn-thread (or name "USOCKET Server") #'real-call) socket)
(values (portable-threads:spawn-thread (or name "USOCKET Server") #'real-call) socket)
(real-call)))))

(defvar *remote-host*)
Expand Down Expand Up @@ -102,7 +95,7 @@
`(,socket ,@(when element-type `(:element-type ,element-type)))))
(client-stream (socket-stream client-socket)))
(if multi-threading
(apply #'spawn-thread "USOCKET Client" real-function client-socket arguments)
(apply #'portable-threads:spawn-thread "USOCKET Client" real-function client-socket arguments)
(prog1 (apply real-function client-socket arguments)
(close client-stream)
(socket-close client-socket)))
Expand Down
16 changes: 8 additions & 8 deletions usocket.asd
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
:licence "MIT"
:description "Universal socket library for Common Lisp"
:depends-on (:split-sequence
#+(and (or sbcl ecl) (not usocket-iolib)) :sb-bsd-sockets
#+usocket-iolib :iolib)
#+(and (or sbcl ecl) (not usocket-iolib)) :sb-bsd-sockets
#+usocket-iolib :iolib)
:components ((:file "package")
(:module "vendor" :depends-on ("package")
:components (#+mcl (:file "kqueue")
Expand All @@ -42,13 +42,13 @@
#+mcl (:file "mcl")
#+mocl (:file "mocl")
#+scl (:file "scl")
#+usocket-iolib (:file "iolib")))
#-usocket-iolib
(:file "option" :depends-on ("backend"))
#+usocket-iolib
#+usocket-iolib (:file "iolib")))
#-usocket-iolib
(:file "option" :depends-on ("backend"))
#+usocket-iolib
(:module "backend" :depends-on ("condition")
:components ((:file "iolib" :depends-on ("iolib-sockopt"))
(:file "iolib-sockopt")))
:components ((:file "iolib" :depends-on ("iolib-sockopt"))
(:file "iolib-sockopt")))
))

(defmethod perform ((op test-op) (c (eql (find-system :usocket))))
Expand Down

0 comments on commit 4d4017a

Please sign in to comment.