Skip to content

Commit

Permalink
Clasp uses the USE-VALUE restart to cycle ports
Browse files Browse the repository at this point in the history
Slime has a feature to cycle through ports until a free one is
found.  I added code so that Clasp takes advantage of this feature.
  • Loading branch information
drmeister committed Jun 14, 2021
1 parent bdda756 commit 98a656d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion swank/clasp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
:type :stream
:protocol :tcp)))
(setf (sb-bsd-sockets:sockopt-reuse-address socket) t)
(sb-bsd-sockets:socket-bind socket (resolve-hostname host) port)
(handler-bind
((SB-BSD-SOCKETS:ADDRESS-IN-USE-ERROR (lambda (err)
(declare (ignore err))
(invoke-restart 'use-value))))
(sb-bsd-sockets:socket-bind socket (resolve-hostname host) port))
(sb-bsd-sockets:socket-listen socket (or backlog 5))
socket))

Expand Down

0 comments on commit 98a656d

Please sign in to comment.