d5962bdd9186

A few minor changes.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 09 Dec 2015 16:00:46 +0000
parents dcaf8468adb1
children d74fc3dab8fa
branches/tags (none)
files src/server.lisp src/utils.lisp

Changes

--- a/src/server.lisp	Sat Dec 05 20:35:38 2015 +0000
+++ b/src/server.lisp	Wed Dec 09 16:00:46 2015 +0000
@@ -47,8 +47,10 @@
 
 (defun handler (socket lock)
   "Read a series of messages from the socket, handling each."
+  (p "Client connected...")
   (handler-case (loop (handle-message socket lock))
-    (end-of-file () nil)))
+    (end-of-file () nil))
+  (p "Client disconnected..."))
 
 
 ;;;; Server
@@ -67,7 +69,7 @@
             (usocket:socket-close client-socket)))
         :name "NREPL Connection Handler"))))
 
-(defun start-server (address port)
+(defun start-server (&optional (address "localhost") (port 8675))
   "Fire up a server thread that will listen for connections."
   (format t "Starting server...~%")
   (let ((socket (usocket:socket-listen address port :reuse-address t)))
--- a/src/utils.lisp	Sat Dec 05 20:35:38 2015 +0000
+++ b/src/utils.lisp	Wed Dec 09 16:00:46 2015 +0000
@@ -50,12 +50,6 @@
   (let ((val (fset:lookup m key)))
     (fset:with m key (funcall f val))))
 
-(defmethod print-object ((object hash-table) stream)
-  (format stream "#HASH{~{~{(~a : ~a)~}~^ ~}}"
-          (loop for key being the hash-keys of object
-                using (hash-value value)
-                collect (list key value))))
-
 (defun read-all-from-string (s)
   (labels ((read-next-from-string (s results)
              (if (equal (string-trim " " s) "")
@@ -97,3 +91,10 @@
                       "id" (fset:lookup message "id")
                       "session" (fset:lookup message "session"))))
 
+
+(defmethod print-object ((object hash-table) stream)
+  (format stream "#HASH{~%~{~{    (~s : ~s)~}~%~}}"
+          (loop for key being the hash-keys of object
+                using (hash-value value)
+                collect (list key value))))
+