diff --git a/cmd/serverFunc.go b/cmd/serverFunc.go index 1ac57df..c91b2c2 100644 --- a/cmd/serverFunc.go +++ b/cmd/serverFunc.go @@ -117,22 +117,20 @@ func handleConn(conn net.Conn) { } go Heartbeat(ID) - time.Sleep(time.Second * 1) - fmt.Println("ATTEMPT") - client, _, _ := returnClient(ID) - client.Instruct( - Instructions{ - IsListFiles: true, - Path: "/home/", - }, - ) - message, err := ServerMessageReceiver(conn) +} + +func requestFiles(client Client, path string) (Response, error) { + inst := Instructions{ + IsListFiles: true, + Path: path, + } + client.Instruct(inst) + message, err := ServerMessageReceiver(client.Conn) if err != nil { - log.Print(err) - } - for _, v := range message.FileList.File { - fmt.Println(v.Name, v.FullPath, v.IsFolder) + log.Println(err) + return message, err } + return message, nil } func sendCommand(client Client, command string) (Output string, err error) {