Fix #84
parent
81b8b04e01
commit
757de005ae
7
conn.go
7
conn.go
|
@ -19,6 +19,7 @@ type Conn struct {
|
|||
*rudp.Conn
|
||||
|
||||
protoVer uint16
|
||||
formspecVer uint16
|
||||
|
||||
username string
|
||||
srp_s []byte
|
||||
|
@ -47,17 +48,17 @@ type Conn struct {
|
|||
modChs map[string]bool
|
||||
|
||||
huds map[uint32]bool
|
||||
|
||||
sounds map[int32]bool
|
||||
|
||||
blocks [][3]int16
|
||||
|
||||
inv *mt.Inv
|
||||
}
|
||||
|
||||
// ProtoVer returns the protocol version of the Conn
|
||||
func (c *Conn) ProtoVer() uint16 { return c.protoVer }
|
||||
|
||||
// FormspecVer returns the formspec API version of the Conn
|
||||
func (c *Conn) FormspecVer() uint16 { return c.formspecVer + 1 }
|
||||
|
||||
// Addr returns the remote address of the Conn
|
||||
func (c *Conn) Addr() net.Addr {
|
||||
return c.Conn.RemoteAddr()
|
||||
|
|
11
init.go
11
init.go
|
@ -209,11 +209,14 @@ func Init(c, c2 *Conn, ignMedia, noAccessDenied bool, fin chan *Conn) {
|
|||
continue
|
||||
}
|
||||
|
||||
v := []byte("5.4.0-dev-dd5a732fa")
|
||||
v := []byte("5.5.0-dev-83a7b48bb")
|
||||
|
||||
w := bytes.NewBuffer([]byte{0x00, ToServerClientReady})
|
||||
w.Write([]byte{5, 4, 0, 0})
|
||||
WriteBytes16(w, v)
|
||||
if c.FormspecVer() != 1 {
|
||||
WriteUint16(w, c.FormspecVer())
|
||||
}
|
||||
|
||||
_, err := c2.Send(rudp.Pkt{
|
||||
Reader: w,
|
||||
|
@ -535,6 +538,12 @@ func Init(c, c2 *Conn, ignMedia, noAccessDenied bool, fin chan *Conn) {
|
|||
return
|
||||
}
|
||||
|
||||
r.Seek(4, io.SeekCurrent)
|
||||
ReadBytes16(r)
|
||||
if r.Len() >= 2 {
|
||||
c2.formspecVer = ReadUint16(r) - 1
|
||||
}
|
||||
|
||||
defaultSrv := ConfKey("default_server").(string)
|
||||
|
||||
defSrv := func() *Conn {
|
||||
|
|
Loading…
Reference in New Issue