Changeset dbde51 for src/dispatch_key.c


Ignore:
Timestamp:
02/01/09 16:02:41 (3 years ago)
Author:
Tomash Brechko <tomash.brechko@…>
Branches:
master
Children:
eece31
Parents:
eef7e5
git-author:
Tomash Brechko <tomash.brechko@…> (02/01/09 15:44:09)
git-committer:
Tomash Brechko <tomash.brechko@…> (02/01/09 16:02:41)
Message:

Better distribution of ketama points.

Feed previous point instead of sequential index.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/dispatch_key.c

    r9729a3 rdbde51  
    11/* 
    2   Copyright (C) 2007-2008 Tomash Brechko.  All rights reserved. 
     2  Copyright (C) 2007-2009 Tomash Brechko.  All rights reserved. 
    33 
    44  When used to build Perl module: 
     
    162162{ 
    163163  static const char delim = '\0'; 
    164   unsigned int crc32; 
     164  unsigned int crc32, point; 
    165165  int count, i; 
    166166 
     
    174174  crc32 = compute_crc32_add(crc32, &delim, 1); 
    175175  crc32 = compute_crc32_add(crc32, port, port_len); 
     176  point = 0; 
    176177 
    177178  for (i = 0; i < count; ++i) 
    178179    { 
    179180      char buf[4]; 
    180       unsigned int point; 
    181181      struct continuum_point *p; 
    182182 
     
    185185        of int as 4 8-bit bytes. 
    186186      */ 
    187       buf[0] = i & 0xff; 
    188       buf[1] = (i >> 8) & 0xff; 
    189       buf[2] = (i >> 16) & 0xff; 
    190       buf[3] = (i >> 24) & 0xff; 
     187      buf[0] = point & 0xff; 
     188      buf[1] = (point >> 8) & 0xff; 
     189      buf[2] = (point >> 16) & 0xff; 
     190      buf[3] = (point >> 24) & 0xff; 
    191191 
    192192      point = compute_crc32_add(crc32, buf, 4); 
Note: See TracChangeset for help on using the changeset viewer.