mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-20 06:10:00 -08:00
gofmt run.
This commit is contained in:
parent
a57908b487
commit
c2f3f0de47
3 changed files with 55 additions and 54 deletions
19
client.go
19
client.go
|
|
@ -114,37 +114,39 @@ func (client *Client) udpreceiver() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
kind := (buf[0] >> 5) & 0x07;
|
kind := (buf[0] >> 5) & 0x07
|
||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case UDPMessageVoiceSpeex: fallthrough;
|
case UDPMessageVoiceSpeex:
|
||||||
case UDPMessageVoiceCELTAlpha: fallthrough;
|
fallthrough
|
||||||
|
case UDPMessageVoiceCELTAlpha:
|
||||||
|
fallthrough
|
||||||
case UDPMessageVoiceCELTBeta:
|
case UDPMessageVoiceCELTBeta:
|
||||||
kind := buf[0] & 0xe0
|
kind := buf[0] & 0xe0
|
||||||
target := buf[0] & 0x1f
|
target := buf[0] & 0x1f
|
||||||
var counter uint8
|
var counter uint8
|
||||||
outbuf := make([]byte, 1024)
|
outbuf := make([]byte, 1024)
|
||||||
|
|
||||||
incoming := packetdatastream.New(buf[1:1+(len(buf)-1)])
|
incoming := packetdatastream.New(buf[1 : 1+(len(buf)-1)])
|
||||||
outgoing := packetdatastream.New(outbuf[1:1+(len(outbuf)-1)])
|
outgoing := packetdatastream.New(outbuf[1 : 1+(len(outbuf)-1)])
|
||||||
_ = incoming.GetUint32()
|
_ = incoming.GetUint32()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
counter = incoming.Next8()
|
counter = incoming.Next8()
|
||||||
incoming.Skip(int(counter & 0x7f))
|
incoming.Skip(int(counter & 0x7f))
|
||||||
if !((counter & 0x80) != 0 && incoming.IsValid()) {
|
if !((counter&0x80) != 0 && incoming.IsValid()) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outgoing.PutUint32(client.Session)
|
outgoing.PutUint32(client.Session)
|
||||||
outgoing.PutBytes(buf[1:1+(len(buf)-1)])
|
outgoing.PutBytes(buf[1 : 1+(len(buf)-1)])
|
||||||
|
|
||||||
// Sever loopback
|
// Sever loopback
|
||||||
if target == 0x1f {
|
if target == 0x1f {
|
||||||
outbuf[0] = kind
|
outbuf[0] = kind
|
||||||
client.sendUdp(&Message{
|
client.sendUdp(&Message{
|
||||||
buf: outbuf[0:1+outgoing.Size()],
|
buf: outbuf[0 : 1+outgoing.Size()],
|
||||||
client: client,
|
client: client,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -305,4 +307,3 @@ func (client *Client) sendUserList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func (server *Server) handleTextMessage(client *Client, msg *Message) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
users := []*Client{};
|
users := []*Client{}
|
||||||
for i := 0; i < len(txtmsg.Session); i++ {
|
for i := 0; i < len(txtmsg.Session); i++ {
|
||||||
user, ok := server.clients[txtmsg.Session[i]]
|
user, ok := server.clients[txtmsg.Session[i]]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ func (server *Server) updateCodecVersions() {
|
||||||
server.PreferAlphaCodec = !server.PreferAlphaCodec
|
server.PreferAlphaCodec = !server.PreferAlphaCodec
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.PreferAlphaCodec) {
|
if server.PreferAlphaCodec {
|
||||||
server.AlphaCodec = winner
|
server.AlphaCodec = winner
|
||||||
} else {
|
} else {
|
||||||
server.BetaCodec = winner
|
server.BetaCodec = winner
|
||||||
|
|
@ -330,7 +330,7 @@ func (server *Server) broadcastProtoMessage(kind uint16, msg interface{}) (err o
|
||||||
if client.state != StateClientAuthenticated {
|
if client.state != StateClientAuthenticated {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err :=client.sendProtoMessage(kind, msg)
|
err := client.sendProtoMessage(kind, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue