From 9547a28faa9b4a9df02bea3cd55b011d615532e9 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 15 Apr 2015 12:41:23 +0200 Subject: Add BIGREQUEST extension support to nxproxy/nxcomp. This work has been started by Paul Szarbo but has been discontinued before final completion. So, this is work in progress. For reference / communication history, see [1]. [1] https://bugs.debian.org/766299 --- nxcomp/SequenceQueue.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'nxcomp/SequenceQueue.h') diff --git a/nxcomp/SequenceQueue.h b/nxcomp/SequenceQueue.h index b243c4c9f..7a88717f7 100644 --- a/nxcomp/SequenceQueue.h +++ b/nxcomp/SequenceQueue.h @@ -18,6 +18,22 @@ #ifndef SequenceQueue_H #define SequenceQueue_H +inline int SequenceNumber_x_gt_y(unsigned int x, unsigned int y) +{ + // For two sequence numbers x and y, determine whether (x > y). + // Sequence numbers are the trailing 16 bits of a bigger number: + // need to handle wraparound, e.g. 0 is 65536, just after 65535. + if (x != (x & 0x00ffff)) return 0; + if (y != (y & 0x00ffff)) return 0; + // Closeness when comparison makes sense: arbitrarily set at 16*1024 + if ((x > y) && ((x-y) < 16*1024)) return 1; + // Wrapped value + unsigned int w = x + 64*1024; + // We know that w>y but test left for symmetry + if ((w > y) && ((w-y) < 16*1024)) return 1; + return 0; +} + // // List of outstanding request messages which // are waiting for a reply. This class is used -- cgit v1.2.3