Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* rudel.el (rudel-host-session): determine a transport and a protocol

  backend; ask the protocol backend to create the session 
* rudel-util.el (rudel-socket-owner):
  (rudel-filter-dispatch):
  (rudel-sentinel-dispatch): removed; made obsolete by transports
* rudel-protocol.el (rudel-protocol-backend::rudel-host): added
  backend argument, which is the transport backend; updated
  documentation string
* rudel-debug.el (rudel-state-machine::rudel-state-change): attached
  method to `rudel-state-machine' instead of `rudel-socket-owner'
  (rudel-debug-stream-name): determine the name from a transport
  object instead of a socket
* obby/rudel-obby.el (require rudel-transport): required for
  transports
  (rudel-obby-backend::rudel-connect): use a transport object instead
  of a socket
  (rudel-obby-backend::rudel-ask-host-info): added :address property
  (rudel-obby-backend::rudel-host): added transport-backend argument;
  do not create a socket but call the
  `rudel-wait-for-connections' method of the transport backend
  (rudel-obby-send): removed; made obsolete by transports
  (rudel-obby-generate-message): new function; used in parsing
  transport filters to serialize obby messages
* obby/rudel-obby-util.el (require rudel-transport-util): new; for
  `rudel-transport-make-filter-stack'
  (rudel-obby-socket-owner): removed; made obsolete by transports
* obby/rudel-obby-server.el (header): bumped version to 0.3
  (rudel-obby-client): removed base class `rudel-obby-socket-owner'
  (rudel-obby-client::transport): new slot; stores transport object
  (rudel-obby-client::initialize-instance): build a transport filter
  stack and install `rudel-accept' as filter
  (rudel-obby-client::rudel-message): removed; `rudel-accept' is
  called by the transport
  (rudel-obby-client::rudel-send): new; send data through transport
  (rudel-obby-server): removed base class `rudel-socket-owner'
  (rudel-obby-server::rudel-add-client): expect a transport object
  instead of a socket
* obby/rudel-obby-debug.el (header): cosmetic changes
  (require rudel-obby-client): new; required since all methods are now
  attached to the `rudel-obby-connection' class
  (rudel-obby-connection::rudel-send): now attached to the
  `rudel-obby-connection' class
  (rudel-obby-connection::rudel-accept): renamed `rudel-receive' ->
  `rudel-accept'; now attached to the `rudel-obby-connection' class
  (rudel-obby-socket-owner::rudel-message): removed; obsolete
  (rudel-obby-connection::rudel-switch): now attached to the
  `rudel-obby-connection' class
* obby/rudel-obby-client.el (header): bumped version to 0.3
  (rudel-obby-client-state-encryption-start::rudel-obby/net6_encryption_begin):
  call transport method to enable encryption
  (rudel-obby-connection): removed base class `rudel-socket-owner'
  (rudel-obby-connection::transport): new slot; stores transport
  object
  (rudel-obby-connection::initialize-instance): build a transport
  filter stack and install `rudel-accept' as filter
  (rudel-obby-connection::rudel-send): new; send data through the
  transport
  (rudel-obby-connection::rudel-message): removed; obsolete
  • Loading branch information...
commit 2fd925df6ab64146dda693244d8571225d7a649d 1 parent 1dc2be4
@scymtym authored
View
71 ChangeLog
@@ -1,3 +1,74 @@
+2009-12-03 Jan Moringen <scymtym@users.sourceforge.net>
+
+ * rudel.el (rudel-host-session): determine a transport and a
+ protocol backend; ask the protocol backend to create the session
+ * rudel-util.el (rudel-socket-owner):
+ (rudel-filter-dispatch):
+ (rudel-sentinel-dispatch): removed; made obsolete by transports
+ * rudel-protocol.el (rudel-protocol-backend::rudel-host): added
+ backend argument, which is the transport backend; updated
+ documentation string
+ * rudel-debug.el (rudel-state-machine::rudel-state-change):
+ attached method to `rudel-state-machine' instead of
+ `rudel-socket-owner'
+ (rudel-debug-stream-name): determine the name from a transport
+ object instead of a socket
+ * obby/rudel-obby.el (require rudel-transport): required for
+ transports
+ (rudel-obby-backend::rudel-connect): use a transport object
+ instead of a socket
+ (rudel-obby-backend::rudel-ask-host-info): added :address property
+ (rudel-obby-backend::rudel-host): added transport-backend
+ argument; do not create a socket but call the
+ `rudel-wait-for-connections' method of the transport backend
+ (rudel-obby-send): removed; made obsolete by transports
+ (rudel-obby-generate-message): new function; used in parsing
+ transport filters to serialize obby messages
+ * obby/rudel-obby-util.el (require rudel-transport-util): new; for
+ `rudel-transport-make-filter-stack'
+ (rudel-obby-socket-owner): removed; made obsolete by transports
+ * obby/rudel-obby-server.el (header): bumped version to 0.3
+ (rudel-obby-client): removed base class `rudel-obby-socket-owner'
+ (rudel-obby-client::transport): new slot; stores transport object
+ (rudel-obby-client::initialize-instance): build a transport filter
+ stack and install `rudel-accept' as filter
+ (rudel-obby-client::rudel-message): removed; `rudel-accept' is
+ called by the transport
+ (rudel-obby-client::rudel-send): new; send data through transport
+ (rudel-obby-server): removed base class `rudel-socket-owner'
+ (rudel-obby-server::rudel-add-client): expect a transport object
+ instead of a socket
+ * obby/rudel-obby-debug.el (header): cosmetic changes
+ (require rudel-obby-client): new; required since all methods are
+ now attached to the `rudel-obby-connection' class
+ (rudel-obby-connection::rudel-send): now attached to the
+ `rudel-obby-connection' class
+ (rudel-obby-connection::rudel-accept): renamed `rudel-receive' ->
+ `rudel-accept'; now attached to the `rudel-obby-connection' class
+ (rudel-obby-socket-owner::rudel-message): removed; obsolete
+ (rudel-obby-connection::rudel-switch): now attached to the
+ `rudel-obby-connection' class
+ * obby/rudel-obby-client.el (header): bumped version to 0.3
+ (rudel-obby-client-state-encryption-start::rudel-obby/net6_encryption_begin):
+ call transport method to enable encryption
+ (rudel-obby-connection): removed base class `rudel-socket-owner'
+ (rudel-obby-connection::transport): new slot; stores transport
+ object
+ (rudel-obby-connection::initialize-instance): build a transport
+ filter stack and install `rudel-accept' as filter
+ (rudel-obby-connection::rudel-send): new; send data through the
+ transport
+ (rudel-obby-connection::rudel-message): removed; obsolete
+
+ * socket/rudel-socket.el
+ (rudel-tcp-backend::rudel-wait-for-connections): when creating the
+ network process, set filter and sentinel to `ignore'
+
+ * tls/rudel-tls.el
+ (rudel-start-tls-backend::rudel-make-connection): create transport
+ object of class `rudel-start-tls-transport' not
+ `rudel-socket-transport'
+
2009-12-02 Jan Moringen <scymtym@users.sourceforge.net>
* obby/rudel-obby.el (rudel-obby-default-port): new constant; used
View
67 obby/rudel-obby-client.el
@@ -29,9 +29,11 @@
;;; History:
;;
-;; 0.2 - State machine.
+;; 0.3 - Support for transports
;;
-;; 0.1 - Initial revision.
+;; 0.2 - State machine
+;;
+;; 0.1 - Initial version
;;; Code:
@@ -96,10 +98,10 @@
((this rudel-obby-client-state-encryption-start))
"Handle net6 'encryption_begin' message."
;; Start TLS encryption for the connection.
- (with-slots (connection) this
- (with-slots (socket) connection
- (when (rudel-process-object socket :supports-tls)
- (rudel-tls-start-tls socket)
+ (with-slots (transport) (oref this :connection)
+ (let ((root-transport (oref transport :root-transport)))
+ (when (rudel-start-tls-transport-child-p root-transport)
+ (rudel-enable-encryption root-transport)
(sit-for 1))))
;; The connection is now established
@@ -745,17 +747,21 @@ failure."))
;;; Class rudel-obby-connection
;;
-(defclass rudel-obby-connection (rudel-obby-socket-owner
- rudel-connection
+(defclass rudel-obby-connection (rudel-connection
rudel-state-machine)
- ((info :initarg :info
- :type list
- :documentation
- "Stores connection information for later use.")
- (contexts :initarg :contexts
- :type hash-table
- :documentation
- "Contains jupiter context objects for all
+ ((transport :initarg :transport
+ :type rudel-transport
+ :documentation
+ "The transport object through which this connection
+sends and receives its data.")
+ (info :initarg :info
+ :type list
+ :documentation
+ "Stores connection information for later use.")
+ (contexts :initarg :contexts
+ :type hash-table
+ :documentation
+ "Contains jupiter context objects for all
documents."))
"Class rudel-obby-connection ")
@@ -771,6 +777,23 @@ documents."))
;; Register states.
(rudel-register-states this rudel-obby-client-connection-states)
+
+ ;; Set up the transport.
+ (with-slots (transport) this
+
+ ;; Build the following transport filter stack:
+ ;; + `rudel-parsing-transport-filter'
+ ;; + `rudel-assembling-transport-filter'
+ ;; + TRANSPORT
+ (setq transport (rudel-obby-make-transport-filter-stack transport))
+
+ ;; Install `rudel-accept' as filter to dispatch messages to the
+ ;; current state machine state.
+ (lexical-let ((this1 this))
+ (rudel-set-filter
+ transport
+ (lambda (data)
+ (rudel-accept this1 data)))))
)
(defmethod rudel-register-state ((this rudel-obby-connection)
@@ -784,6 +807,11 @@ documents."))
(call-next-method))
)
+(defmethod rudel-send ((this rudel-obby-connection) &rest args)
+ "Send ARGS through the transport of THIS."
+ (with-slots (transport) this
+ (rudel-send transport args)))
+
(defmethod rudel-disconnect ((this rudel-obby-connection))
""
(when (next-method-p)
@@ -817,13 +845,6 @@ documents."))
(with-slots (contexts) this
(remhash (oref document :id) contexts)))
-(defmethod rudel-message ((this rudel-obby-connection) message)
- "Dispatch MESSAGE to the current state of THIS object.
-If the state has no suitable method, generate a warning, but do
-nothing else."
- ;; Dispatch message to state.
- (rudel-accept this message))
-
(defmethod rudel-change-color- ((this rudel-obby-connection) color)
""
(rudel-send this "obby_user_colour"
View
39 obby/rudel-obby-debug.el
@@ -27,7 +27,7 @@
;;; History:
;;
-;; 0.1 - Initial revision.
+;; 0.1 - Initial version
;;; Code:
@@ -38,6 +38,7 @@
(require 'rudel-debug)
(require 'rudel-obby-util)
+(require 'rudel-obby-client)
;;; Variables
@@ -50,15 +51,15 @@
;;; Functions
;;
-(defmethod rudel-send :before ((this rudel-obby-socket-owner)
+(defmethod rudel-send :before ((this rudel-obby-connection)
name &rest arguments)
"Print NAME and ARGUMENTS to debug stream."
(let ((message (apply #'rudel-obby-assemble-message
name arguments)))
- (with-slots (socket) this
+ (with-slots (transport) this
(rudel-debug-stream-insert
- (rudel-debug-stream-name socket)
+ (rudel-debug-stream-name transport)
:sent
(concat (substring message 0 (min (length message) 100))
(when (> (length message) 100)
@@ -66,34 +67,18 @@
(append (list name) arguments))))
)
-(defmethod rudel-receive :before ((this rudel-obby-socket-owner) data)
+(defmethod rudel-accept :before ((this rudel-obby-connection) data)
"Print DATA to debug stream."
- (with-slots (socket) this
+ (with-slots (transport) this
(rudel-debug-stream-insert
- (rudel-debug-stream-name socket)
+ (rudel-debug-stream-name transport)
:received
(concat (substring data 0 (min (length data) 100))
(when (> (length data) 100)
"..."))))
)
-(defmethod rudel-message :before ((this rudel-obby-socket-owner)
- message)
- "Print DATA to debug stream."
- (let ((data (apply #'rudel-obby-assemble-message message)))
-
- (with-slots (socket) this
- (rudel-debug-stream-insert
- (rudel-debug-stream-name socket)
- :received
- (concat (substring data 0 (min (length data) 100))
- (when (> (length data) 100)
- "..."))
- message)
- ))
- )
-
-(defmethod rudel-switch :before ((this rudel-obby-socket-owner)
+(defmethod rudel-switch :before ((this rudel-obby-connection)
state &rest arguments)
"Store name of STATE for later printing."
(with-slots (state) this
@@ -103,15 +88,15 @@
"#start")))
)
-(defmethod rudel-switch :after ((this rudel-obby-socket-owner)
+(defmethod rudel-switch :after ((this rudel-obby-connection)
state &rest arguments)
"Print STATE and ARGUMENTS to debug stream."
- (with-slots (socket state) this
+ (with-slots (transport state) this
(let ((old-state rudel-obby-debug-old-state)
(new-state (object-name-string state)))
(unless (string= old-state new-state)
(rudel-debug-stream-insert
- (rudel-debug-stream-name socket)
+ (rudel-debug-stream-name transport)
:special
(if arguments
(format "%s -> %s %s" old-state new-state arguments)
View
51 obby/rudel-obby-server.el
@@ -38,9 +38,11 @@
;;; History:
;;
-;; 0.2 - State machine.
+;; 0.3 - Support for transports
;;
-;; 0.1 - Initial revision.
+;; 0.2 - State machine
+;;
+;; 0.1 - Initial version
;;; Code:
@@ -476,9 +478,13 @@ of her color to COLOR."
;;; Class rudel-obby-client
;;
-(defclass rudel-obby-client (rudel-obby-socket-owner
- rudel-state-machine)
- ((server :initarg :server
+(defclass rudel-obby-client (rudel-state-machine)
+ ((transport :initarg :transport
+ :type rudel-transport
+ :documentation
+ "The transport object through which this
+connection sends and receives its data.")
+ (server :initarg :server
:type rudel-obby-server
:documentation
"")
@@ -509,6 +515,23 @@ handled by the server.")
;; Register states.
(rudel-register-states this rudel-obby-server-connection-states)
+
+ ;; Set up the transport.
+ (with-slots (transport) this
+
+ ;; Build the following transport filter stack:
+ ;; + `rudel-parsing-transport-filter'
+ ;; + `rudel-assembling-transport-filter'
+ ;; + TRANSPORT
+ (setq transport (rudel-obby-make-transport-filter-stack transport))
+
+ ;; Install `rudel-accept' as filter to dispatch messages to the
+ ;; current state machine state.
+ (lexical-let ((this1 this))
+ (rudel-set-filter
+ transport
+ (lambda (data)
+ (rudel-accept this1 data)))))
)
(defmethod rudel-register-state ((this rudel-obby-client) symbol state)
@@ -528,10 +551,10 @@ handled by the server.")
(with-slots (server) this
(rudel-remove-client server this)))
-(defmethod rudel-message ((this rudel-obby-client) message)
- "Dispatch MESSAGE to the active state of THIS state machine."
- ;; Dispatch message to state
- (rudel-accept this message))
+(defmethod rudel-send ((this rudel-obby-client) &rest args)
+ "Send ARGS through the transport of THIS."
+ (with-slots (transport) this
+ (rudel-send transport args)))
(defmethod rudel-broadcast ((this rudel-obby-client)
receivers name &rest arguments)
@@ -610,8 +633,7 @@ handled by the server.")
;;; Class rudel-obby-server
;;
-(defclass rudel-obby-server (rudel-server-session
- rudel-socket-owner)
+(defclass rudel-obby-server (rudel-server-session)
((clients :initarg :clients
:type list
:initform nil
@@ -721,12 +743,13 @@ user. COLOR has to be sufficiently different from used colors."
)
(defmethod rudel-add-client ((this rudel-obby-server)
- client-socket)
+ client-transport)
""
(with-slots (next-client-id clients) this
- (let ((client (rudel-obby-client (process-name client-socket)
+ (let ((client (rudel-obby-client
+ (object-name client-transport)
:server this
- :socket client-socket
+ :transport client-transport
:id next-client-id
:encryption nil)))
(push client clients))
View
57 obby/rudel-obby-util.el
@@ -40,48 +40,11 @@
(require 'eieio)
-(require 'rudel)
-(require 'rudel-util)
-
(require 'jupiter)
-
-;;; Class rudel-obby-socket-owner
-;;
-
-(defclass rudel-obby-socket-owner (rudel-socket-owner)
- ((buffer :initarg :buffer
- :type (or null string)
- :initform nil
- :documentation
- "Stores message fragments until complete messages can
-be assembled."))
- "This class adds functions for sending and receiving obby
-messages to the base class rudel-socket-owner.")
-
-(defmethod rudel-send ((this rudel-obby-socket-owner)
- name &rest arguments)
- "Send obby message NAME with arguments ARGUMENTS through the socket associated to THIS."
- (with-slots (socket) this
- (rudel-obby-send socket name arguments)))
-
-(defmethod rudel-receive ((this rudel-obby-socket-owner) data)
- "Reassemble lines in DATA received on the socket associated with THIS and call message handler."
- ;; Assemble fragmented lines.
- (with-slots (buffer) this
- (rudel-assemble-line-fragments data buffer))
-
- ;; Process all available lines.
- (rudel-loop-lines data line
- ;; `rudel-message' has to dispatch message to an appropriate
- ;; handler.
- (let ((message (rudel-obby-parse-message line)))
- (rudel-message this message)))
- )
-
-(defgeneric rudel-message ((this rudel-obby-socket-owner) message)
- "Called when a message arrives.
-Should be implemented in derived classes.")
+(require 'rudel)
+(require 'rudel-util)
+(require 'rudel-transport-util) ;; for `rudel-transport-make-filter-stack'
;;; Message serialization
@@ -240,6 +203,20 @@ construction of the name of the new operation. "
"Nothing to convert if THIS is a nop.")
+;;; Transport functions
+;;
+
+(defun rudel-obby-make-transport-filter-stack (transport)
+ "Construct an obby protocol filter stack on top of TRANSPORT."
+ (rudel-transport-make-filter-stack
+ transport
+ '((rudel-assembling-transport-filter
+ :assembly-function rudel-assemble-lines)
+ (rudel-parsing-transport-filter
+ :parse-function rudel-obby-parse-message
+ :generate-function rudel-obby-generate-message))))
+
+
;;; Miscellaneous functions
;;
View
84 obby/rudel-obby.el
@@ -48,6 +48,7 @@
(require 'rudel)
(require 'rudel-backend)
+(require 'rudel-transport)
(require 'rudel-protocol)
(require 'rudel-util)
(require 'rudel-icons)
@@ -148,18 +149,15 @@ Return the connection object."
;; Create the network process
(let* ((session (plist-get info :session))
(host (plist-get info :host))
- (port (plist-get info :port))
(encryption (plist-get info :encryption))
(connection (rudel-obby-connection
host
- :session session
- :socket (oref transport :socket)
- :info info)))
+ :session session
+ :transport transport
+ :info info)))
;; Start the transport and wait until the basic session setup is
;; complete.
- (set-process-filter (oref transport :socket) #'rudel-filter-dispatch)
- (set-process-sentinel (oref transport :socket) #'rudel-sentinel-dispatch)
(rudel-start transport)
(rudel-state-wait connection
@@ -233,37 +231,30 @@ Return the connection object."
(defmethod rudel-ask-host-info ((this rudel-obby-backend))
"Ask user for information required to host an obby session."
(let ((port (read-number "Port: " 6522)))
- (list :port port)))
+ (list
+ :address "0.0.0.0"
+ :port port)))
-(defmethod rudel-host ((this rudel-obby-backend) info)
+(defmethod rudel-host ((this rudel-obby-backend) transport-backend info)
"Host an obby session using the information INFO.
Return the created server."
;; Before we start, we load the server functionality.
(require 'rudel-obby-server)
- ;; Create the network process.
- (let* ((port (plist-get info :port))
- ;; Make a server socket
- (socket (make-network-process
- :name "obby-server"
- :host "0.0.0.0"
- :service port
- :server t
- :filter #'rudel-filter-dispatch
- :sentinel #'rudel-sentinel-dispatch
- ;;
- :log
- (lambda (server-process client-process message)
- (let ((server (rudel-process-object server-process)))
- (rudel-add-client server client-process)))))
- ;; Construct server object.
- (server (rudel-obby-server "obby-server"
- :backend this
- :socket socket)))
-
- ;; Return the constructed server.
- server)
- )
+ ;; Construct and return the server object.
+ (let ((server (rudel-obby-server
+ "obby-server"
+ :backend this)))
+
+ ;; Dispatch incoming connections to SERVER.
+ (lexical-let ((server1 server))
+ (rudel-wait-for-connections
+ transport-backend info
+ (lambda (client-transport)
+ (rudel-add-client server1 client-transport))))
+
+ ;; Return the constructed server object.
+ server))
(defmethod rudel-make-document ((this rudel-obby-backend)
name session)
@@ -489,25 +480,18 @@ The terminating `\n' should be removed from MESSAGE before
calling this function."
(mapcar #'rudel-obby-unescape-string (split-string message ":")))
-(defun rudel-obby-send (socket name arguments)
- "Send an obby message NAME with arguments ARGUMENTS through SOCKET."
- ;; First, assemble the message string.
- (let ((message (apply #'rudel-obby-assemble-message
- name arguments)))
- (if (>= (length message) rudel-obby-long-message-threshold)
- ;; For huge messages, chunk the message data and transmit the
- ;; chunks
- (let ((total (/ (length message)
- rudel-obby-long-message-chunk-size))
- (current 0)
- (reporter (make-progress-reporter "Sending data " 0.0 1.0)))
- (rudel-loop-chunks message chunk rudel-obby-long-message-chunk-size
- (progress-reporter-update reporter (/ (float current) total))
- (process-send-string socket chunk)
- (incf current))
- (progress-reporter-done reporter))
- ;; Send small messages in one chunk
- (process-send-string socket message)))
+(defun rudel-obby-generate-message (name-and-args)
+ "Transform NAME and arguments into an obby protocol message.
+
+The resulting message is a string that looks like this:
+\"NAME:ARG1:ARG2:...:ARGN\\n\""
+ (concat (mapconcat
+ (lambda (part)
+ (if (and (not (null part)) (stringp part)) ;; TODO temp
+ (rudel-obby-escape-string part)
+ part))
+ name-and-args ":")
+ "\n")
)
View
8 rudel-debug.el
@@ -167,7 +167,7 @@
;;; Socket debugging
;;
-(defmethod rudel-state-change :before ((this rudel-socket-owner)
+(defmethod rudel-state-change :before ((this rudel-state-machine)
state message)
"Print STATE and MESSAGE to debug stream."
(with-slots (socket) this
@@ -184,9 +184,9 @@
;;; Utility functions
;;
-(defun rudel-debug-stream-name (socket)
- "Return debug stream name for SOCKET."
- (process-name socket))
+(defun rudel-debug-stream-name (transport)
+ "Return debug stream name for TRANSPORT."
+ (object-name-string transport))
(defun rudel-debug-stream-insert (stream tag data &optional object)
"Insert DATA and possibly OBJECT into stream using TAG as style."
View
9 rudel-protocol.el
@@ -83,8 +83,13 @@ connection will be associated.")
"Retrieve information for hosting a session from user.
Return a property list that contains the collected information.")
-(defgeneric rudel-host ((this rudel-protocol-backend) info)
- "Create a new session according to the property list INFO.")
+(defgeneric rudel-host ((this rudel-protocol-backend) backend
+ info)
+ "Create a new session according to the property list INFO.
+BACKEND has to be an object of a class derived from
+`rudel-transport-backend' and has to have the listen
+capability.
+The created session object is returned.")
(defgeneric rudel-make-document ((this rudel-protocol-backend)
name session)
View
55 rudel-util.el
@@ -96,50 +96,6 @@ list of hooks."
(apply #'run-hook-with-args 'hook this arguments)))
-;;; Class rudel-socket-owner
-;;
-
-(defclass rudel-socket-owner ()
- ((socket :initarg :socket
- :type process
- :documentation
- "The process object representing the socket through
-which the communication happens."))
- "Class rudel-socket-owner ")
-
-(defmethod initialize-instance :after ((this rudel-socket-owner)
- &rest slots)
- "Attach THIS to as process object of our socket."
- ;; Attach to our socket.
- (with-slots (socket) this
- (rudel-set-process-object socket this))
- )
-
-(defmethod rudel-disconnect ((this rudel-socket-owner))
- "Disconnect the network connection owned by THIS."
- (with-slots (socket) this
- (delete-process socket)))
-
-(defmethod rudel-state-change ((this rudel-socket-owner) state message)
- "Called when the state of THIS changes to STATE.
-MESSAGE is the message emitted when the state transition
-occurred."
- (with-slots (socket) this
- (case state
- ;; Nothing to do here.
- (run
- nil)
-
- ;; Dispatch events which indicate the termination of the
- ;; connection to `rudel-close'.
- ((closed failed exit)
- (rudel-close this))))
- )
-
-(defmethod rudel-close ((this rudel-socket-owner))
- "Called when the connection associated to THIS is closed.")
-
-
;;; Networking helper functions and macros
;;
@@ -155,17 +111,6 @@ occurred."
(setq key :object))
(put (intern (process-name process)) key object))
-(defun rudel-filter-dispatch (process data)
- "Call `rudel-receive' method of object attached to PROCESS with DATA."
- (let ((object (rudel-process-object process)))
- (rudel-receive object data)))
-
-(defun rudel-sentinel-dispatch (process message)
- "Call `rudel-state-change' method of the object attached to PROCESS with state and MESSAGE."
- (let ((object (rudel-process-object process))
- (state (process-status process)))
- (rudel-state-change object state message)))
-
;;; Fragmentation and assembling functions.
;;
View
27 rudel.el
@@ -866,22 +866,17 @@ All data required to host a session will be prompted for
interactively."
(interactive)
;; If necessary, ask the user for the backend we should use.
- (let* ((backend (cdr (rudel-backend-choose
- 'protocol
- (lambda (backend)
- (rudel-capable-of-p backend 'host)))))
- (info (rudel-ask-host-info backend))
- (server))
-
- ;; Try to create the server
- (condition-case error-data
- (setq server (rudel-host backend info))
- ('error
- (error "Could not host session using backend `%s' with %s: %s"
- (object-name-string backend)
- info
- (car error-data))))
- server))
+ (let* ((transport-backend (cdr (rudel-backend-choose
+ 'transport
+ (lambda (backend)
+ (rudel-capable-of-p backend 'listen)))))
+ (protocol-backend (cdr (rudel-backend-choose
+ 'protocol
+ (lambda (backend)
+ (rudel-capable-of-p backend 'host)))))
+ (info (rudel-ask-host-info protocol-backend)))
+ ;; Create the session object.
+ (rudel-host protocol-backend transport-backend info)))
;;;###autoload
(defun rudel-end-session ()
Please sign in to comment.
Something went wrong with that request. Please try again.