Use stopforward instead of forward
parent
bbca924ef0
commit
0490e3fd3e
|
@ -47,8 +47,6 @@ func (l *Listener) Accept() (*Peer, error) {
|
|||
l.mu.Unlock()
|
||||
}()
|
||||
|
||||
clt.forward = true
|
||||
|
||||
clt.aoIDs = make(map[uint16]bool)
|
||||
|
||||
maxPeers, ok := GetConfKey("player_limit").(int)
|
||||
|
|
8
peer.go
8
peer.go
|
@ -27,7 +27,7 @@ type Peer struct {
|
|||
authMech int
|
||||
sudoMode bool
|
||||
|
||||
forward bool
|
||||
stopforward bool
|
||||
|
||||
redirectMu sync.Mutex
|
||||
srvMu sync.RWMutex
|
||||
|
@ -42,10 +42,10 @@ type Peer struct {
|
|||
func (p *Peer) Username() string { return string(p.username) }
|
||||
|
||||
// Forward reports whether the Proxy func should continue or stop
|
||||
func (p *Peer) Forward() bool { return p.forward }
|
||||
func (p *Peer) Forward() bool { return !p.stopforward }
|
||||
|
||||
// StopForwarding tells the Proxy func to stop
|
||||
func (p *Peer) stopForwarding() { p.forward = false }
|
||||
func (p *Peer) stopForwarding() { p.stopforward = true }
|
||||
|
||||
// Server returns the Peer this Peer is connected to
|
||||
// if it isn't a server
|
||||
|
@ -83,8 +83,6 @@ func (p *Peer) SetServer(s *Peer) {
|
|||
func Connect(conn net.PacketConn, addr net.Addr) (*Peer, error) {
|
||||
srv := &Peer{Peer: rudp.Connect(conn, addr)}
|
||||
|
||||
srv.forward = true
|
||||
|
||||
ack, err := srv.Send(rudp.Pkt{Data: []byte{0, 0}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue