Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPEN-X-STREAM refactoring, abstract UNIX support, IPv6 support #167

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions dependent.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -909,14 +909,22 @@

#+(or sbcl ecl clasp)
(defun make-unix-x-socket (path)
(handler-case
(let ((socket (make-instance 'local-socket :type :stream)))
(socket-connect socket path)
socket)
(error (condition)
(values nil (list "~@<Could not connect to UNIX socket ~S: ~
~A~@:>"
path condition)))))
(let ((errors '()))
(flet ((try (socket-class path)
(handler-case
(let ((socket (make-instance socket-class :type :stream)))
(socket-connect socket path)
socket)
(error (condition)
(push (list socket-class condition) errors)
nil))))
(or (try 'local-abstract-socket path)
(try 'local-socket path)
(values nil (list "~@<Could not connect to X server socket ~
via UNIX socket ~S:~@:_~
~{~{* ~@<Using a ~S failed: ~
~A~@:>~}~^~@:_~}~:>"
path errors))))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither class is implemented in ecl. I understand that it is meant to be future-proof, but in that case maybe adding a fallback operation which prepends 0 to the path (could be used for other implementations too) is a good idea?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought ECL and Clasp copied the entire interface. I will have to rethink the approach.


#+(or sbcl ecl clasp)
(defun make-inet-x-socket (host port)
Expand Down