Browse Source

Buffered or unbuffered? That is the question.

pull/2/head
Justine Alexandra Roberts Tunney 11 years ago
parent
commit
1bdbfbf2cc
4 changed files with 9 additions and 8 deletions
  1. +1
    -1
      rtp/session.go
  2. +2
    -0
      sip/dialog.go
  3. +4
    -5
      sip/receiver.go
  4. +2
    -2
      sip/transport.go

+ 1
- 1
rtp/session.go View File

@ -53,7 +53,7 @@ func NewSession(host string) (rs *Session, err error) {
return nil, err
}
rs = &Session{
C: make(chan *Frame, 32),
C: make(chan *Frame, 4),
E: make(chan error, 1),
Sock: sock.(*net.UDPConn),
Header: Header{


+ 2
- 0
sip/dialog.go View File

@ -256,6 +256,8 @@ func (dls *dialogState) cleanup() {
if dls.sock != nil {
dls.sock.Close()
dls.sock = nil
_, _ = <-dls.sockMsgs
<-dls.sockErrs
}
}


+ 4
- 5
sip/receiver.go View File

@ -1,7 +1,6 @@
package sip
import (
"github.com/jart/gosip/util"
"log"
"net"
"strconv"
@ -13,10 +12,8 @@ func ReceiveMessages(contact *Addr, sock *net.UDPConn, c chan<- *Msg, e chan<- e
for {
amt, addr, err := sock.ReadFromUDP(buf)
if err != nil {
if !util.IsUseOfClosed(err) {
e <- err
}
return
e <- err
break
}
ts := time.Now()
packet := string(buf[0:amt])
@ -36,6 +33,8 @@ func ReceiveMessages(contact *Addr, sock *net.UDPConn, c chan<- *Msg, e chan<- e
fixMessagesFromStrictRouters(contact, msg)
c <- msg
}
close(c)
close(e)
}
func addReceived(msg *Msg, addr *net.UDPAddr) {


+ 2
- 2
sip/transport.go View File

@ -48,8 +48,8 @@ func NewTransport(contact *Addr) (tp *Transport, err error) {
contact.Next = nil
contact.Uri.Port = uint16(addr.Port)
contact.Uri.Params["transport"] = "udp"
c := make(chan *Msg, 32)
e := make(chan error, 1)
c := make(chan *Msg)
e := make(chan error)
tp = &Transport{
C: c,
E: e,


Loading…
Cancel
Save