This commit is contained in:
Tim Cooper 2016-03-25 22:05:23 -03:00
parent 083163daf9
commit 20eba760e5
15 changed files with 163 additions and 163 deletions

View file

@ -330,7 +330,7 @@ func (client *Client) udpRecvLoop() {
case mumbleproto.UDPMessageVoiceCELTAlpha:
fallthrough
case mumbleproto.UDPMessageVoiceCELTBeta:
if (client.server.Opus) {
if client.server.Opus {
return
}
fallthrough

View file

@ -1,59 +1,59 @@
// Copyright (c) 2012 The Grumble Authors
// The use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE-file.
package main
import (
"github.com/golang/protobuf/proto"
"mumble.info/grumble/pkg/replacefile"
"io/ioutil"
"path/filepath"
"strconv"
)
func (server *Server) freezeToFile() (err error) {
// Close the log file, if it's open
if server.freezelog != nil {
err = server.freezelog.Close()
if err != nil {
return err
}
}
// Make sure the whole server is synced to disk
fs, err := server.Freeze()
if err != nil {
return err
}
f, err := ioutil.TempFile(filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10)), ".main.fz_")
if err != nil {
return err
}
buf, err := proto.Marshal(fs)
if err != nil {
return err
}
_, err = f.Write(buf)
if err != nil {
return err
}
err = f.Sync()
if err != nil {
return err
}
err = f.Close()
if err != nil {
return err
}
src := f.Name()
dst := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "main.fz")
backup := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "backup.fz")
err = replacefile.ReplaceFile(dst, src, backup, replacefile.Flag(0))
if err != nil {
return err
}
return nil
}
// Copyright (c) 2012 The Grumble Authors
// The use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE-file.
package main
import (
"github.com/golang/protobuf/proto"
"io/ioutil"
"mumble.info/grumble/pkg/replacefile"
"path/filepath"
"strconv"
)
func (server *Server) freezeToFile() (err error) {
// Close the log file, if it's open
if server.freezelog != nil {
err = server.freezelog.Close()
if err != nil {
return err
}
}
// Make sure the whole server is synced to disk
fs, err := server.Freeze()
if err != nil {
return err
}
f, err := ioutil.TempFile(filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10)), ".main.fz_")
if err != nil {
return err
}
buf, err := proto.Marshal(fs)
if err != nil {
return err
}
_, err = f.Write(buf)
if err != nil {
return err
}
err = f.Sync()
if err != nil {
return err
}
err = f.Close()
if err != nil {
return err
}
src := f.Name()
dst := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "main.fz")
backup := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "backup.fz")
err = replacefile.ReplaceFile(dst, src, backup, replacefile.Flag(0))
if err != nil {
return err
}
return nil
}

View file

@ -676,12 +676,12 @@ func (server *Server) finishAuthenticate(client *Client) {
func (server *Server) updateCodecVersions(connecting *Client) {
codecusers := map[int32]int{}
var (
winner int32
count int
users int
opus int
winner int32
count int
users int
opus int
enableOpus bool
txtMsg *mumbleproto.TextMessage = &mumbleproto.TextMessage{
txtMsg *mumbleproto.TextMessage = &mumbleproto.TextMessage{
Message: proto.String("<strong>WARNING:</strong> Your client doesn't support the Opus codec the server is switching to, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support."),
}
)
@ -1357,7 +1357,7 @@ func (server *Server) CurrentPort() int {
// Returns the host address the server will listen on when
// it is started. This must be an IP address, either IPv4
// or IPv6.
// or IPv6.
func (server *Server) HostAddress() string {
host := server.cfg.StringValue("Address")
if host == "" {