xmpp/layer1.go
changeset 147 d7679d991b17
parent 145 21a390dd3506
child 148 b1b4900eee5b
equal deleted inserted replaced
146:aa9a0ae8f875 147:d7679d991b17
     7 	"io"
     7 	"io"
     8 	"net"
     8 	"net"
     9 	"time"
     9 	"time"
    10 )
    10 )
    11 
    11 
    12 func (cl *Client) readTransport(w io.WriteCloser) {
    12 func (cl *Client) recvTransport(w io.WriteCloser) {
    13 	defer w.Close()
    13 	defer w.Close()
    14 	p := make([]byte, 1024)
    14 	p := make([]byte, 1024)
    15 	for {
    15 	for {
    16 		if cl.socket == nil {
    16 		if cl.socket == nil {
    17 			cl.waitForSocket()
    17 			cl.waitForSocket()
    33 			break
    33 			break
    34 		}
    34 		}
    35 	}
    35 	}
    36 }
    36 }
    37 
    37 
    38 func (cl *Client) writeTransport(r io.Reader) {
    38 func (cl *Client) sendTransport(r io.Reader) {
    39 	defer cl.socket.Close()
    39 	defer cl.socket.Close()
    40 	p := make([]byte, 1024)
    40 	p := make([]byte, 1024)
    41 	for {
    41 	for {
    42 		nr, err := r.Read(p)
    42 		nr, err := r.Read(p)
    43 		if nr == 0 {
    43 		if nr == 0 {