Bind 绑定服务
(serverId int64, remoteAddr string, maxConnsPerServer int, maxConnsPerIP int)
| 42 | |
| 43 | // Bind 绑定服务 |
| 44 | func (this *BaseClientConn) Bind(serverId int64, remoteAddr string, maxConnsPerServer int, maxConnsPerIP int) bool { |
| 45 | if this.isBound { |
| 46 | return true |
| 47 | } |
| 48 | this.isBound = true |
| 49 | this.serverId = serverId |
| 50 | this.remoteAddr = remoteAddr |
| 51 | this.hasLimit = true |
| 52 | |
| 53 | // 检查是否可以连接 |
| 54 | return sharedClientConnLimiter.Add(this.rawConn.RemoteAddr().String(), serverId, remoteAddr, maxConnsPerServer, maxConnsPerIP) |
| 55 | } |
| 56 | |
| 57 | // SetServerId 设置服务ID |
| 58 | func (this *BaseClientConn) SetServerId(serverId int64) (goNext bool) { |
nothing calls this directly
no test coverage detected