// HandleConnection from the given connection
HandleConnection from the given connection
// HandleConnection from the given connection
func (server *Server) HandleConnection(connection *Connection) {
	if debug {
		log.Println("Handling client connection from " + connection.Conn.RemoteAddr().String())
	}
	for {
		packet, err := connection.Receive()
		if err != nil {
			if debug {
				if err == io.EOF {
					log.Printf("Client %s closed the connection", connection.Conn.RemoteAddr())
				} else {
					log.Printf("error while trying to receive packet from %s: %s", connection.Conn.RemoteAddr(), err)
				}
			}
			return
		}
		clientData := &ClientData{Packet: packet, Connection: connection}
		go func(data *ClientData) {
			server.ReceiveChannel <- data
		}(clientData)
	}
}
func ( server * Server ) HandleConnection ( connection * Connection ) { if debug { log . Println ( " " + connection . Conn . RemoteAddr ( ) . String ( ) ) } for { packet , err := connection . Receive ( ) if err != nil { if debug { if err == io . EOF { log . Printf ( " " , connection . Conn . RemoteAddr ( ) ) } else { log . Printf ( " " , connection . Conn . RemoteAddr ( ) , err ) } } return } clientData := & ClientData { Packet : packet , Connection : connection } go func ( data * ClientData ) { server . ReceiveChannel <- data } ( clientData ) } }
HandleConnection from the given connection
HandleConnection from the given connection
// send data to receiving channel without blocking