def requestRehash(oldBucket, newBucket):
     if oldBucket == Bucket.bucketNbr:
         Bucket.rehash(Bucket.fs)
     else:
         bucketAddress = Bucket.bucketList[oldBucket].split()
         bucketHost, bucketPort = bucketAddress[0], int(bucketAddress[1])
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         try:
             # Connect to server and send data
             sock.connect((bucketHost, bucketPort))
             print("Connected to {}:{}".format(bucketHost, bucketPort))
             data = "REHASH {}".format(Bucket.fs.extent)
             sock.sendall(bytes(data + "\n", "utf-8"))
             received = str(sock.recv(1024), "utf-8")
         finally:
             #Close connection
             sock.close()
 def requestRehash(oldBucket):
     if oldBucket == Bucket.bucketNbr:
         Bucket.rehash(Bucket.fs)
     else:
         bucketAddress = Bucket.bucketList[oldBucket].split()
         bucketHost, bucketPort = bucketAddress[0], int(bucketAddress[1])
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         try:
             # Connect to server and send data
             sock.connect((bucketHost, bucketPort))
             print("Connected to {}:{}".format(bucketHost, bucketPort))
             data = "REHASH {}".format(Bucket.fs.extent)
             sock.sendall(bytes(data + "\n", "utf-8"))
         #                received = str(sock.recv(1024), "utf-8")
         #                Waiting for the response will cause a dead lock if the target
         #                bucket would like to populate bucketList
         finally:
             #Close connection
             sock.close()