Avoid assert crash after bytestream position wrap around

Fixes #652.
diff --git a/common/rfb/Congestion.cxx b/common/rfb/Congestion.cxx
index 4d36d9f..8162808 100644
--- a/common/rfb/Congestion.cxx
+++ b/common/rfb/Congestion.cxx
@@ -68,6 +68,11 @@
 // limit for now...
 static const unsigned MAXIMUM_WINDOW = 4194304;
 
+// Compare position even when wrapped around
+static inline bool isAfter(unsigned a, unsigned b) {
+  return (int)a - (int)b > 0;
+}
+
 static LogWriter vlog("Congestion");
 
 Congestion::Congestion() :
@@ -230,7 +235,7 @@
   targetAcked = lastPosition - congWindow;
 
   // Simple case?
-  if (lastPong.pos > targetAcked)
+  if (isAfter(lastPong.pos, targetAcked))
     return 0;
 
   // No measurements yet?
@@ -269,7 +274,7 @@
       etaNext -= delay;
 
     // Found it?
-    if (curPing.pos > targetAcked) {
+    if (isAfter(curPing.pos, targetAcked)) {
       eta += etaNext * (curPing.pos - targetAcked) / (curPing.pos - prevPing->pos);
       if (elapsed > eta)
         return 0;