Revision fbeb4f32 loop.c

View differences:

loop.c
46 46
  period.tv_usec = csize % 1000000;
47 47
  
48 48
  sigInit(s,pset);
49
  update_peers(pset, NULL, 0);
49
  update_peers(pset, NULL, NULL, 0);
50 50
  stream_init(buff_size, s);
51 51
  while (!done) {
52 52
    int len, res;
......
60 60
      len = recv_from_peer(s, &remote, buff, BUFFSIZE);
61 61
      switch (buff[0] /* Message Type */) {
62 62
        case MSG_TYPE_TOPOLOGY:
63
          update_peers(pset, buff, len);
63
          update_peers(pset, remote, buff, len);
64 64
          break;
65 65
        case MSG_TYPE_CHUNK:
66 66
          received_chunk(pset, remote, buff, len);
......
78 78
      //send_chunk(pset);
79 79
      send_offer(pset);
80 80
      if (cnt++ % 10 == 0) {
81
        update_peers(pset,NULL, 0);
81
        update_peers(pset, NULL, NULL, 0);
82 82
      }
83 83
      timeradd(&tnext, &period, &tmp);
84 84
      tnext = tmp;
......
108 108
      struct nodeID *remote;
109 109

  
110 110
      len = recv_from_peer(s, &remote, buff, BUFFSIZE);
111
      dprintf("Received message (%c) from %s\n", buff[0], node_addr(remote));
111 112
      switch (buff[0] /* Message Type */) {
112 113
        case MSG_TYPE_TOPOLOGY:
113 114
          fprintf(stderr, "Top Parse\n");
114
          update_peers(pset, buff, len);
115
          update_peers(pset, remote, buff, len);
115 116
          break;
116 117
        case MSG_TYPE_CHUNK:
117 118
          fprintf(stderr, "Some dumb peer pushed a chunk to me!\n");
......
133 134
          send_chunk(pset);
134 135
        }
135 136
        if (cnt++ % 10 == 0) {
136
            update_peers(pset, NULL, 0);
137
            update_peers(pset, NULL, NULL, 0);
137 138
        }
138 139
      }
139 140
      timeradd(&tnext, &d, &tmp);

Also available in: Unified diff