From 73e322b84535d5dfd2d312538dc56326b9223bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Fri, 20 Oct 2017 18:35:30 +0300 Subject: [PATCH] Adding some comments to GetFile --- server/server/commands.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/server/commands.go b/server/server/commands.go index 82aaca2..f9424d9 100644 --- a/server/server/commands.go +++ b/server/server/commands.go @@ -27,6 +27,7 @@ func GetFile(c net.Conn, path string) (int, error) { fileName = path } + // Open the file file, err := os.Open(PATH + fileName) if err != nil { // Open file failed. @@ -35,6 +36,8 @@ func GetFile(c net.Conn, path string) (int, error) { } defer file.Close() // Closing the fd when the function has exited. + // Read all the data at once. + // we need to re-think this. data, err := ioutil.ReadAll(file) n, err := c.Write(data) if err != nil {