Git Product home page Git Product logo

agent's Issues

协议序号校验

看到代码里有段逻辑是进行协议序号校验的,可以防止重放攻击:
// 数据包序列号验证
if seq_id != sess.PacketCount {
sess.Flag |= SESS_KICKED_OUT
return nil
}
很多情况下这可能造成误判,有时候并不是故意重放,比如客户端由于网络原因没有收到服务器回包,会重发上一次请求,这属于正常重放。

go 版本升级到1.9.1 kcp 出问题

panic: reflect: call of reflect.Value.Int on zero Value

goroutine 9 [running]:
reflect.Value.Int(0x0, 0x0, 0x0, 0x174d146)
/usr/local/go/src/reflect/value.go:908 +0x141
agent/vendor/golang.org/x/net/ipv4.sysfd(0x1a8d440, 0xc42000e1a8, 0x136d8c8, 0xc420041e60, 0xc420041fa8)
/Users/apple/gamejob/gonet2/src/agent/vendor/golang.org/x/net/ipv4/helper_unix.go:46 +0x196
agent/vendor/golang.org/x/net/ipv4.(*genericOpt).sysfd(0xc420041ec0, 0x16a2de0, 0x172e8c0, 0x1)
/Users/apple/gamejob/gonet2/src/agent/vendor/golang.org/x/net/ipv4/helper_unix.go:17 +0x57
agent/vendor/golang.org/x/net/ipv4.(*genericOpt).SetTOS(0xc420041ec0, 0xb8, 0xc42000e1a8, 0x1a8d440)
/Users/apple/gamejob/gonet2/src/agent/vendor/golang.org/x/net/ipv4/genericopt_posix.go:29 +0x45
agent/vendor/github.com/xtaci/kcp-go.(*Listener).SetDSCP(0xc420114680, 0x2e, 0x0, 0x0)

game服务发送Game_Kick消息无法断开与客户端的连接

似乎是这里的case <-sess.Die无法进去,不知道该怎么改...

for {
		// solve dead link problem:
		// physical disconnection without any communcation between client and server
		// will cause the read to block FOREVER, so a timeout is a rescue.
		conn.SetReadDeadline(time.Now().Add(config.readDeadline))

		// read 2B header
		n, err := io.ReadFull(conn, header)
		if err != nil {
			log.Warningf("read header failed, ip:%v reason:%v size:%v", sess.IP, err, n)
			return
		}
		size := binary.BigEndian.Uint16(header)

		// alloc a byte slice of the size defined in the header for reading data
		payload := make([]byte, size)
		n, err = io.ReadFull(conn, payload)
		if err != nil {
			log.Warningf("read payload failed, ip:%v reason:%v size:%v", sess.IP, err, n)
			return
		}

		// deliver the data to the input queue of agent()
		select {
		case in <- payload: // payload queued
		case <-sess.Die:
			log.Warningf("connection closed by logic, flag:%v ip:%v", sess.Flag, sess.IP)
			return
		}
	}

是否可以支持go get

既然现在不依赖gvp/gvm了,是不是可以改下目录结构来支持go get
只要设定好了GOPATH, 直接
go get -u github.com/gonet2/{agent,game}
就可以clone并安装好agent和game
方便快速的体验

grpc-go的stream只能创建100

同一个grpc连接,当stream创建超过100个的话,超出的stream创建会卡死
也就是说agent和game之间最多只能创建100个session的链接

Binary request

Hello sir can you provide binary for Linux 32 bit please .I have tried to compile but i have error

go build
route.go:10:2: cannot find package "agent/client_handler" in any of:
/root/go/src/agent/client_handler (from $GOROOT)
/root/goworkspace/src/agent/client_handler (from $GOPATH)
buffer.go:11:2: cannot find package "agent/misc/packet" in any of:
/root/go/src/agent/misc/packet (from $GOROOT)
/root/goworkspace/src/agent/misc/packet (from $GOPATH)
agent.go:8:2: cannot find package "agent/pb" in any of:
/root/go/src/agent/pb (from $GOROOT)
/root/goworkspace/src/agent/pb (from $GOPATH)
startup.go:4:2: cannot find package "agent/services" in any of:
/root/go/src/agent/services (from $GOROOT)
/root/goworkspace/src/agent/services (from $GOPATH)
agent.go:9:2: cannot find package "agent/types" in any of:
/root/go/src/agent/types (from $GOROOT)
/root/goworkspace/src/agent/types (from $GOPATH)
agent.go:10:2: cannot find package "agent/utils" in any of:
/root/go/src/agent/utils (from $GOROOT)
/root/goworkspace/src/agent/utils (from $GOPATH)

update_task被阻塞了,算BUG吗?

描述:当客户端第一次连接的时候,在 proxy_user_request 处理时 被 SESS_KICKED_OUT了。

这时候update_task还没来的及调用,客户端还没有收到kcp的ACK包,会一直重复发数据。

qq 20161006120140
加入<-time.After(1 * time.Second) update_task才被调用。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.