summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-09-10 03:48:27 -0400
committerJoe Crayne <joe@jerkface.net>2018-09-21 18:18:58 -0400
commit444f4b4ea199d1fda71fdd28c9b1826596214566 (patch)
treedf1b6d6898d54951969a8bf709c8e3a28c1cba31 /src/Data
parentdcbfc57c019d5f58c15c9f34c171cf63b88e1a38 (diff)
Fixed PacketRequest bug: resource exhausted (Message too long)
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/PacketQueue.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Data/PacketQueue.hs b/src/Data/PacketQueue.hs
index aa51426b..15a3b436 100644
--- a/src/Data/PacketQueue.hs
+++ b/src/Data/PacketQueue.hs
@@ -103,8 +103,10 @@ getMissing PacketQueue { pktq, seqno, qsize, buffend } = do
103 seqno0 <- readTVar seqno 103 seqno0 <- readTVar seqno
104 buffend0 <- readTVar buffend 104 buffend0 <- readTVar buffend
105 -- note relying on fact that [ b .. a ] is null when a < b 105 -- note relying on fact that [ b .. a ] is null when a < b
106 let indices = take (fromIntegral qsize) $ map (`mod` qsize) [ seqno0 .. buffend0 - 1] 106 let indices = take (fromIntegral qsize) $ [ seqno0 .. buffend0 - 1]
107 maybes <- mapM (\i -> do {x <- readArray pktq i; return (i,x)}) indices 107 maybes <- forM indices $ \i -> do
108 x <- readArray pktq $ i `mod` qsize
109 return (i,x)
108 let nums = map fst . filter (isNothing . snd) $ maybes 110 let nums = map fst . filter (isNothing . snd) $ maybes
109 return nums 111 return nums
110 112