+/* ------------------------------------------------------
+ * Open-addressed hash using double hash probing
+ *
+ * for i in 0 to m-1:
+ * h(k, i) = ( h1(k) + i*h2(k) ) mod m
+ *
+ * requires: 1) m must be a power of two
+ * 2) h2(k) must return an odd number
+ *
+ * Besed on code published in _Mastering Algorithms in C_
+ * by Kyle Loudon (O'Reilly 1999).
+ * Modified by Philip Kovacs (kovacsp3@comcast.net)
+ *
+ * $Id$
+ * ------------------------------------------------------ */
+
#ifdef HASH_DEBUG
#include <stdio.h>
#endif
-#ifndef HASH_H
-#define HASH_H
-
/* ------------------------------------------------------
* Open-addressed hash using double hash probing
*
* Besed on code published in _Mastering Algorithms in C_
* by Kyle Loudon (O'Reilly 1999).
* Modified by Philip Kovacs (kovacsp3@comcast.net)
+ *
+ * $Id$
* ------------------------------------------------------ */
+#ifndef HASH_H
+#define HASH_H
+
typedef struct _hash_table_t {
int positions;
int size;
* libtcp-portmon.c: tcp port monitoring library.
*
* Copyright (C) 2005 Philip Kovacs kovacsp3@comcast.net
+ *
+ * $Id$
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* connection limit. Future versions should probably allow the client to set the hash size
* and load limits and/or provide for automatic resizing of hashes. */
- if ( (double)p_monitor->hash.size / (double)p_monitor->hash.positions > TCP_CONNECTION_HASH_MAX_LOAD_PCT )
+ if ( (double)p_monitor->hash.size / (double)p_monitor->hash.positions >= TCP_CONNECTION_HASH_MAX_LOAD_PCT )
{
/* hash exceeds our load limit is now "full" */
return;
*
* Copyright (C) 2005 Philip Kovacs kovacsp3@comcast.net
*
+ * $Id$
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either