Improved environment
This commit is contained in:
@ -9,13 +9,12 @@ import (
|
||||
|
||||
// login checks the account credentials and gives a network peer access to an account.
|
||||
func login(data []byte, client *core.Client) {
|
||||
fmt.Println("2 - login!")
|
||||
|
||||
if bytes.Equal(data, []byte("password")) {
|
||||
fmt.Println("login success")
|
||||
server.Send(packet.LOGIN, []byte{0}, client)
|
||||
} else {
|
||||
if !bytes.Equal(data, []byte("password")) {
|
||||
fmt.Println("login failure")
|
||||
server.Send(packet.LOGIN, []byte{1}, client)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("login success")
|
||||
server.Send(packet.LOGIN, []byte{0}, client)
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"server/core"
|
||||
"server/packet"
|
||||
)
|
||||
|
||||
// ping is used as a heartbeat and latency check.
|
||||
func ping(data []byte, client *core.Client) {
|
||||
fmt.Println("1 - ping")
|
||||
server.Send(packet.PING, data, client)
|
||||
}
|
||||
|
Reference in New Issue
Block a user