Changeset 13902 for release


Ignore:
Timestamp:
Jun 29, 2010, 5:38:31 PM (9 years ago)
Author:
rme
Message:

Revert r13894 and merge r13773: udp sockets only support :binary format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/1.5/source/level-1/l1-sockets.lisp

    r13894 r13902  
    453453(defmethod socket-type ((stream udp-socket)) :datagram)
    454454(defmethod socket-connect ((stream udp-socket)) nil)
     455(defmethod socket-format ((stream udp-socket)) :binary)
    455456
    456457(defgeneric socket-os-fd (socket)
     
    949950            #+x8664-target (and (>= subtype x8664::min-8-bit-ivector-subtag)
    950951                                (<= subtype x8664::max-8-bit-ivector-subtag))
    951       (report-bad-arg buf `(or (array character)
    952                                (array (unsigned-byte 8))
     952      (report-bad-arg buf '(or (array (unsigned-byte 8))
    953953                               (array (signed-byte 8))))))
    954954  (values buf offset))
    955955
    956956(defmethod send-to ((socket udp-socket) msg size
    957                     &key remote-host remote-port offset (external-format :ISO-8859-1))
     957                    &key remote-host remote-port offset)
    958958  "Send a UDP packet over a socket."
    959959  (let ((fd (socket-device socket)))
    960     (when (stringp msg) (setf msg (ccl::ENCODE-STRING-TO-OCTETS msg :external-format external-format)))
    961960    (multiple-value-setq (msg offset) (verify-socket-buffer msg offset size))
    962961    (unless remote-host
     
    974973      (setf (pref sockaddr :sockaddr_in.sin_port)
    975974            (if remote-port (port-as-inet-port remote-port "udp") 0))
    976             (%stack-block ((bufptr size))
     975      (%stack-block ((bufptr size))
    977976        (%copy-ivector-to-ptr msg offset bufptr 0 size)
    978977        (socket-call socket "sendto"
     
    980979            (c_sendto fd bufptr size 0 sockaddr (record-length :sockaddr_in))))))))
    981980
    982 (defmethod receive-from ((socket udp-socket) size &key buffer extract offset (encoding #.(lookup-character-encoding :iso-8859-1)))
     981(defmethod receive-from ((socket udp-socket) size &key buffer extract offset)
    983982  "Read a UDP packet from a socket. If no packets are available, wait for
    984   a packet to arrive.
    985   Returns four values:
     983a packet to arrive. Returns four values:
    986984  The buffer with the data
    987985  The number of bytes read
     
    10051003      (setf (pref namelen :signed) (record-length :sockaddr_in))
    10061004      (%stack-block ((bufptr size))
    1007         (setq ret-size (socket-call socket "recvfrom"
    1008                                     (with-eagain fd :input
    1009                                       (c_recvfrom fd bufptr size 0 sockaddr namelen))))
    1010         (unless vec
    1011           (setq vec (make-array ret-size
    1012                                 :element-type
    1013                                 (ecase (socket-format socket)
    1014                                   ((:text) 'base-char)
    1015                                   ((:binary :bivalent) '(unsigned-byte 8))))
    1016                 vec-offset 0))
    1017        
    1018         (ecase (socket-format socket)
    1019           ((:text) (funcall (character-encoding-memory-decode-function encoding) bufptr ret-size 0 vec))
    1020           ((:binary (%copy-ptr-to-ivector bufptr 0 vec vec-offset ret-size)))))
    1021      
     1005        (setq ret-size (socket-call socket "recvfrom"
     1006                         (with-eagain fd :input
     1007                           (c_recvfrom fd bufptr size 0 sockaddr namelen))))
     1008        (unless vec
     1009          (setq vec (make-array ret-size
     1010                                :element-type
     1011                                (ecase (socket-format socket)
     1012                                  ((:binary) '(unsigned-byte 8))))
     1013                vec-offset 0))
     1014        (%copy-ptr-to-ivector bufptr 0 vec vec-offset ret-size))
    10221015      (values (cond ((null buffer)
    10231016                     vec)
Note: See TracChangeset for help on using the changeset viewer.