newKcpServerConn :for Server, method to create a Client-side connection with Client-specific properties (创建一个Client服务端特性的连接的方法)
(client ziface.IClient, conn *kcp.UDPSession)
| 159 | // newKcpServerConn :for Server, method to create a Client-side connection with Client-specific properties |
| 160 | // (创建一个Client服务端特性的连接的方法) |
| 161 | func newKcpClientConn(client ziface.IClient, conn *kcp.UDPSession) ziface.IConnection { |
| 162 | c := &KcpConnection{ |
| 163 | conn: conn, |
| 164 | connID: 0, // client ignore |
| 165 | connIdStr: "", // client ignore |
| 166 | msgBuffChan: nil, |
| 167 | property: nil, |
| 168 | name: client.GetName(), |
| 169 | localAddr: conn.LocalAddr().String(), |
| 170 | remoteAddr: conn.RemoteAddr().String(), |
| 171 | } |
| 172 | |
| 173 | lengthField := client.GetLengthField() |
| 174 | if lengthField != nil { |
| 175 | c.frameDecoder = zinterceptor.NewFrameDecoder(*lengthField) |
| 176 | } |
| 177 | |
| 178 | // Inherited properties from server (从client继承过来的属性) |
| 179 | c.packet = client.GetPacket() |
| 180 | c.onConnStart = client.GetOnConnStart() |
| 181 | c.onConnStop = client.GetOnConnStop() |
| 182 | c.msgHandler = client.GetMsgHandler() |
| 183 | |
| 184 | return c |
| 185 | } |
| 186 | |
| 187 | // StartWriter is the goroutine that writes messages to the client |
| 188 | // (写消息Goroutine, 用户将数据发送给客户端) |
nothing calls this directly
no test coverage detected