Skip to content

Commit

Permalink
fix codebase for recent changes in ponyc (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfelsche committed Jun 8, 2018
1 parent 340e9c7 commit aca6a7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions broadcast.pony
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Broadcast[A: Any #share] is SubscriberManager[A]
if _max_request == 0 then
// No subscribers have pending demand.
if _queue.size().u64() == _qbound then
try _queue.shift() end
try _queue.shift()? end
end

_queue.push(a)
Expand All @@ -84,7 +84,7 @@ class Broadcast[A: Any #share] is SubscriberManager[A]
if _queue.size().u64() == _qbound then
// We have hit our bound and must drop from the queue.
try
_queue.shift()
_queue.shift()?
_queue.push(a)

for (sub, state) in _map.pairs() do
Expand Down Expand Up @@ -167,7 +167,7 @@ class Broadcast[A: Any #share] is SubscriberManager[A]
ManagedPublisher._on_request.
"""
try
let state = _map(sub)
let state = _map(sub)?
var inc = n

if (state.request == 0) and (state.queue_position < _queue.size().u64())
Expand All @@ -176,10 +176,10 @@ class Broadcast[A: Any #share] is SubscriberManager[A]
var count = inc.min(_queue.size().u64() - state.queue_position)

try
var node = _queue.index(state.queue_position.usize())
var node = _queue.index(state.queue_position.usize())?

for i in Range[U64](0, count) do
sub.on_next(node())
sub.on_next(node()?)

if node.has_next() then
node = node.next() as ListNode[A]
Expand Down Expand Up @@ -217,7 +217,7 @@ class Broadcast[A: Any #share] is SubscriberManager[A]
ManagedPublisher._on_cancel.
"""
try
(_, let state) = _map.remove(sub)
(_, let state) = _map.remove(sub)?

if
(state.request == 0) and
Expand Down Expand Up @@ -254,7 +254,7 @@ class Broadcast[A: Any #share] is SubscriberManager[A]
if min_queue_position > 0 then
try
for i in Range[U64](0, min_queue_position) do
_queue.shift()
_queue.shift()?
end
end

Expand Down
4 changes: 2 additions & 2 deletions unicast.pony
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Unicast[A: Any #share]
sub.on_next(a)
else
if _queue.size().u64() == _qbound then
_queue.shift()
_queue.shift()?
end

_queue.push(a)
Expand Down Expand Up @@ -123,7 +123,7 @@ class Unicast[A: Any #share]

while (_queue.size() > 0) and (_request > 0) do
try
sub.on_next(_queue.shift())
sub.on_next(_queue.shift()?)
_request = _request - 1
end
end
Expand Down

0 comments on commit aca6a7f

Please sign in to comment.