1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00
This commit is contained in:
Zack Scholl 2017-10-17 12:30:51 -06:00
parent f4fbf8c23e
commit b912a7a024

View file

@ -8,6 +8,7 @@ import (
"time" "time"
) )
// runClient spawns threads for parallel uplink/downlink via TCP
func runClient(connectionType string, codePhrase string) { func runClient(connectionType string, codePhrase string) {
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(numberConnections) wg.Add(numberConnections)
@ -27,17 +28,23 @@ func runClient(connectionType string, codePhrase string) {
if connectionType == "s" { if connectionType == "s" {
message = receiveMessage(connection) message = receiveMessage(connection)
fmt.Println(message) fmt.Println(message)
// TODO: Write data from file
// Send file name // Send file name
sendMessage("filename", connection) sendMessage("filename", connection)
// Send file size // Send file size
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
sendMessage("filesize", connection) sendMessage("filesize", connection)
// TODO: Write data from file
// TODO: Release from connection pool
// POST /release
} else { } else {
// TODO: Pull data and write to file
fileName := receiveMessage(connection) fileName := receiveMessage(connection)
fileSize := receiveMessage(connection) fileSize := receiveMessage(connection)
fmt.Println(fileName, fileSize) fmt.Println(fileName, fileSize)
// TODO: Pull data and write to file
// TODO: Release from connection pool
// POST /release
} }
}(id) }(id)