Skip to content

Commit

Permalink
Fixed replication progress was no longer updated
Browse files Browse the repository at this point in the history
  • Loading branch information
jannickheisch committed Oct 27, 2023
1 parent 1060a77 commit 20075cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class Node(val context: MainActivity) {
val chnk_buf = context.tinyRepo.mk_chnk_vect()
if (chnk_buf != null)
context.tinyIO.enqueue(chnk_buf, context.tinyDemux.chnk_dmx)

// TODO update_progress(vector.toSortedMap().values.toList(), "me")
}

fun incoming_pkt(buf: ByteArray, fid: ByteArray) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Repo(val context: MainActivity) {
}

fun mk_want_vect(): ByteArray? {
want_is_valid = false // not implemented yet
want_is_valid = false // TODO optimization not implemented yet
if (want_is_valid) return null

val lst = ArrayList<Int>()
Expand All @@ -154,9 +154,19 @@ class Repo(val context: MainActivity) {
if (encoding_len > 100)
break
}

want_offs = (want_offs + i + 1) % context.tinyGoset.keys.size
want_is_valid = true


if(lst.size > 1) {
var vec = lst.slice(1 .. lst.lastIndex) // want_vector without offset
vec = vec.mapIndexed { index, i ->
val new_idx =(index + want_offs) % vec.size
lst.slice(1 .. lst.lastIndex)[new_idx]}

context.tinyNode.update_progress(vec, "me")

return Bipf.encode(Bipf.mkList(lst))
}
return null
Expand Down

0 comments on commit 20075cb

Please sign in to comment.