File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 8
8
"net"
9
9
"time"
10
10
"crypto/sha1"
11
+ "regexp"
11
12
)
12
13
13
14
type Network struct {
@@ -230,10 +231,18 @@ func (network *Network) AddToStore(message string) {
230
231
}
231
232
232
233
func (network * Network ) LookForData (hash string ) (bool , string ) {
234
+
235
+ //Corrects hash if it is formatted wrong
236
+ if (string (hash [0 ]) == "\" " ){
237
+ hash = hash [1 :len (hash )- 1 ]
238
+ var re = regexp .MustCompile (`[ ]` )
239
+ hash = re .ReplaceAllString (hash , `,` )
240
+ }
241
+
233
242
for key , element := range network .routingTable .me .KeyValueStore {
234
- fmt .Println ("LookForData loop" )
235
- fmt .Println ("Key: " + key )
236
- fmt .Println ("Hash: " + hash )
243
+ // fmt.Println("LookForData loop")
244
+ // fmt.Println("Key: " + key)
245
+ // fmt.Println("Hash: " + hash)
237
246
238
247
if key == hash {
239
248
fmt .Println ("LookForData found element: " + element )
You can’t perform that action at this time.
0 commit comments