Show
Ignore:
Timestamp:
04/25/08 18:20:34 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1209147634 +0000
git-parent:

[d67a38b6a56900457dc690b2dd62cbd081dca6aa]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1209147634 +0000
Message:

compiles on linux -- still no eventer, refs #12

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stratcon_datastore.c

    rbce2dd5 ra504323  
    1212#include <unistd.h> 
    1313#include <netinet/in.h> 
     14#include <sys/un.h> 
    1415#include <arpa/inet.h> 
    1516#include <libpq-fe.h> 
     
    9091__get_conn_q_for_remote(struct sockaddr *remote) { 
    9192  conn_q *cq; 
    92   if(noit_hash_retrieve(&ds_conns, (const char *)remote, remote->sa_len, 
    93                         (void **)&cq)) 
     93  int len = 0; 
     94  switch(remote->sa_family) { 
     95    case AF_INET: len = sizeof(struct sockaddr_in); break; 
     96    case AF_INET6: len = sizeof(struct sockaddr_in6); break; 
     97    case AF_UNIX: len = SUN_LEN(((struct sockaddr_un *)remote)); break; 
     98    default: return NULL; 
     99  } 
     100  if(noit_hash_retrieve(&ds_conns, (const char *)remote, len, (void **)&cq)) 
    94101    return cq; 
    95102  cq = calloc(1, sizeof(*cq)); 
    96   cq->remote = malloc(remote->sa_len); 
    97   memcpy(cq->remote, remote, remote->sa_len); 
     103  cq->remote = malloc(len); 
     104  memcpy(cq->remote, remote, len); 
    98105  cq->jobq = calloc(1, sizeof(*cq->jobq)); 
    99106  eventer_jobq_init(cq->jobq); 
     
    101108  /* Add one thread */ 
    102109  eventer_jobq_increase_concurrency(cq->jobq); 
    103   noit_hash_store(&ds_conns, (const char *)cq->remote, cq->remote->sa_len, cq); 
     110  noit_hash_store(&ds_conns, (const char *)cq->remote, len, cq); 
    104111  return cq; 
    105112}