aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-11-08 18:02:11 -0500
committersotech117 <michael_foiani@brown.edu>2023-11-08 18:02:11 -0500
commita787b00605d8f89e0978eb9956b516296c85d0e3 (patch)
treedf99370ceb9d48e7f5e426cc3e20736526ed6336
parent921dd3c38a052861d0523e775efd2f1dac45ebcc (diff)
parent8345c70da5ca872916b2d524e83bbecbb7e24fae (diff)
Merge branch 'main' of https://github.com/brown-cs1680-f23/iptcp-jailpt2
merge w david
-rw-r--r--cmd/vhost/main.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/vhost/main.go b/cmd/vhost/main.go
index 6a78b97..ca4700e 100644
--- a/cmd/vhost/main.go
+++ b/cmd/vhost/main.go
@@ -141,7 +141,11 @@ func main() {
fmt.Println(err)
continue
}
- conn, _ := sockets[socketID]
+ conn, inMap := sockets[socketID]
+ if !inMap {
+ fmt.Println("Invalid socket ID")
+ continue
+ }
message := tokens[2:]
messageToSend := strings.Join(message, " ")
messageToSendBytes := []byte(messageToSend)
@@ -166,7 +170,11 @@ func main() {
fmt.Println(err)
continue
}
- conn, _ := sockets[socketID]
+ conn, inMap := sockets[socketID]
+ if !inMap {
+ fmt.Println("Invalid socket ID")
+ continue
+ }
// buffer := make([]byte, numberOfBytes)
bytesRead, message, err := conn.VRead(numberOfBytes)
if err != nil {