mirror of
https://github.com/jech/galene.git
synced 2024-12-22 15:25:48 +01:00
Run gofmt.
This commit is contained in:
parent
325f288189
commit
4fde2c40e6
7 changed files with 38 additions and 39 deletions
|
@ -15,7 +15,7 @@ func TestEstimator(t *testing.T) {
|
|||
e.Accumulate(128)
|
||||
e.estimate(now + rtptime.JiffiesPerSec)
|
||||
rate, packetRate :=
|
||||
e.estimate(now + (rtptime.JiffiesPerSec * 1001) / 1000)
|
||||
e.estimate(now + (rtptime.JiffiesPerSec*1001)/1000)
|
||||
|
||||
if rate != 42+128 {
|
||||
t.Errorf("Expected %v, got %v", 42+128, rate)
|
||||
|
|
|
@ -69,7 +69,7 @@ func TestJSON(t *testing.T) {
|
|||
}
|
||||
|
||||
func BenchmarkPlain(b *testing.B) {
|
||||
for i :=0; i < b.N; i++ {
|
||||
for i := 0; i < b.N; i++ {
|
||||
match, err := pw2.Match("bad")
|
||||
if err != nil || match {
|
||||
b.Errorf("pw2 matched")
|
||||
|
@ -78,7 +78,7 @@ func BenchmarkPlain(b *testing.B) {
|
|||
}
|
||||
|
||||
func BenchmarkPBKDF2(b *testing.B) {
|
||||
for i :=0; i < b.N; i++ {
|
||||
for i := 0; i < b.N; i++ {
|
||||
match, err := pw3.Match("bad")
|
||||
if err != nil || match {
|
||||
b.Errorf("pw3 matched")
|
||||
|
|
|
@ -350,7 +350,7 @@ func TestBitmapPacket(t *testing.T) {
|
|||
}
|
||||
|
||||
p := rtcp.NackPair{first, rtcp.PacketBitmap(bitmap)}
|
||||
p.Range(func (s uint16) bool {
|
||||
p.Range(func(s uint16) bool {
|
||||
if s < 42 || s >= 42+64 {
|
||||
if (value & (1 << (s - 42))) != 0 {
|
||||
t.Errorf("Bit %v unexpectedly set", s-42)
|
||||
|
|
|
@ -574,7 +574,7 @@ func gotNACK(conn *rtpDownConnection, track *rtpDownTrack, p *rtcp.TransportLaye
|
|||
var packet rtp.Packet
|
||||
buf := make([]byte, packetcache.BufSize)
|
||||
for _, nack := range p.Nacks {
|
||||
nack.Range(func (seqno uint16) bool {
|
||||
nack.Range(func(seqno uint16) bool {
|
||||
l := track.remote.GetRTP(seqno, buf)
|
||||
if l == 0 {
|
||||
unhandled = append(unhandled, seqno)
|
||||
|
|
|
@ -29,11 +29,11 @@ func errorToWSCloseMessage(id string, err error) (*clientMessage, []byte) {
|
|||
code = websocket.CloseProtocolError
|
||||
s := e.Error()
|
||||
m = &clientMessage{
|
||||
Type: "usermessage",
|
||||
Kind: "error",
|
||||
Dest: id,
|
||||
Privileged: true,
|
||||
Value: &s,
|
||||
Type: "usermessage",
|
||||
Kind: "error",
|
||||
Dest: id,
|
||||
Privileged: true,
|
||||
Value: &s,
|
||||
}
|
||||
text = e.Error()
|
||||
case group.UserError, group.KickError:
|
||||
|
@ -708,7 +708,7 @@ func StartClient(conn *websocket.Conn) (err error) {
|
|||
}
|
||||
|
||||
type pushConnAction struct {
|
||||
group *group.Group
|
||||
group *group.Group
|
||||
id string
|
||||
conn conn.Up
|
||||
tracks []conn.UpTrack
|
||||
|
@ -720,7 +720,7 @@ type addLabelAction struct {
|
|||
}
|
||||
|
||||
type pushConnsAction struct {
|
||||
group *group.Group
|
||||
group *group.Group
|
||||
client group.Client
|
||||
}
|
||||
|
||||
|
@ -943,7 +943,6 @@ func leaveGroup(c *webClient) {
|
|||
c.group = nil
|
||||
}
|
||||
|
||||
|
||||
func failDownConnection(c *webClient, id string, message string) error {
|
||||
if id != "" {
|
||||
err := c.write(clientMessage{
|
||||
|
@ -1178,14 +1177,14 @@ func handleClientMessage(c *webClient, m clientMessage) error {
|
|||
}
|
||||
}
|
||||
mm := clientMessage{
|
||||
Type: m.Type,
|
||||
Id: m.Id,
|
||||
Dest: m.Dest,
|
||||
Username: m.Username,
|
||||
Privileged: c.permissions.Op,
|
||||
Time: tm,
|
||||
Kind: m.Kind,
|
||||
Value: m.Value,
|
||||
Type: m.Type,
|
||||
Id: m.Id,
|
||||
Dest: m.Dest,
|
||||
Username: m.Username,
|
||||
Privileged: c.permissions.Op,
|
||||
Time: tm,
|
||||
Kind: m.Kind,
|
||||
Value: m.Value,
|
||||
}
|
||||
if m.Dest == "" {
|
||||
clients := g.GetClients(nil)
|
||||
|
@ -1428,11 +1427,11 @@ func errorMessage(id string, err error) *clientMessage {
|
|||
case group.UserError:
|
||||
message := e.Error()
|
||||
return &clientMessage{
|
||||
Type: "usermessage",
|
||||
Kind: "error",
|
||||
Dest: id,
|
||||
Privileged: true,
|
||||
Value: &message,
|
||||
Type: "usermessage",
|
||||
Kind: "error",
|
||||
Dest: id,
|
||||
Privileged: true,
|
||||
Value: &message,
|
||||
}
|
||||
case group.KickError:
|
||||
message := e.Message
|
||||
|
@ -1440,13 +1439,13 @@ func errorMessage(id string, err error) *clientMessage {
|
|||
message = "you have been kicked out"
|
||||
}
|
||||
return &clientMessage{
|
||||
Type: "usermessage",
|
||||
Kind: "error",
|
||||
Id: e.Id,
|
||||
Username: e.Username,
|
||||
Dest: id,
|
||||
Privileged: true,
|
||||
Value: &message,
|
||||
Type: "usermessage",
|
||||
Kind: "error",
|
||||
Id: e.Id,
|
||||
Username: e.Username,
|
||||
Dest: id,
|
||||
Privileged: true,
|
||||
Value: &message,
|
||||
}
|
||||
default:
|
||||
return nil
|
||||
|
|
|
@ -39,7 +39,7 @@ func NTPToTime(ntp uint64) time.Time {
|
|||
sec := uint32(ntp >> 32)
|
||||
frac := uint32(ntp & 0xFFFFFFFF)
|
||||
return ntpEpoch.Add(
|
||||
time.Duration(sec) * time.Second +
|
||||
time.Duration(sec)*time.Second +
|
||||
((time.Duration(frac) * time.Second) >> 32),
|
||||
)
|
||||
}
|
||||
|
@ -48,5 +48,5 @@ func TimeToNTP(tm time.Time) uint64 {
|
|||
d := tm.Sub(ntpEpoch)
|
||||
sec := uint32(d / time.Second)
|
||||
frac := uint32(d % time.Second)
|
||||
return (uint64(sec) << 32) + (uint64(frac) << 32) / uint64(time.Second)
|
||||
return (uint64(sec) << 32) + (uint64(frac)<<32)/uint64(time.Second)
|
||||
}
|
||||
|
|
|
@ -21,15 +21,15 @@ func differs(a, b, delta uint64) bool {
|
|||
if a < b {
|
||||
a, b = b, a
|
||||
}
|
||||
return a - b >= delta
|
||||
return a-b >= delta
|
||||
}
|
||||
|
||||
func TestTime(t *testing.T) {
|
||||
a := Now(48000)
|
||||
time.Sleep(4 * time.Millisecond)
|
||||
b := Now(48000) - a
|
||||
if differs(b, 4 * 48, 16) {
|
||||
t.Errorf("Expected %v, got %v", 4 * 48, b)
|
||||
if differs(b, 4*48, 16) {
|
||||
t.Errorf("Expected %v, got %v", 4*48, b)
|
||||
}
|
||||
|
||||
c := Microseconds()
|
||||
|
@ -68,7 +68,7 @@ func TestNTP(t *testing.T) {
|
|||
}
|
||||
if diff2 > (1 << 8) {
|
||||
t.Errorf("Expected %v, got %v (diff=%v)",
|
||||
ntp, ntp2, float64(diff2) / float64(1<<32))
|
||||
ntp, ntp2, float64(diff2)/float64(1<<32))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue