Revision 5232d493 src/net_helper.c

View differences:

src/net_helper.c
114 114
{
115 115
}
116 116

  
117
void reg_message_send(int size, uint8_t type);
118

  
117 119
int send_to_peer(const struct nodeID *from, struct nodeID *to, const uint8_t *buffer_ptr, int buffer_size)
118 120
{
119 121
  static struct msghdr msg;
......
121 123
  struct iovec iov[2];
122 124
  int res;
123 125

  
126
  if (buffer_size <= 0) return;
127
  reg_message_send(buffer_size, buffer_ptr[0]);
128

  
124 129
  iov[0].iov_base = &my_hdr;
125 130
  iov[0].iov_len = 1;
126 131
  msg.msg_name = &to->addr;
......
145 150
  return res;
146 151
}
147 152

  
153
void reg_message_recv(int size, uint8_t type);
154

  
148 155
int recv_from_peer(const struct nodeID *local, struct nodeID **remote, uint8_t *buffer_ptr, int buffer_size)
149 156
{
150 157
  int res, recv;
......
152 159
  static struct msghdr msg;
153 160
  static uint8_t my_hdr;
154 161
  struct iovec iov[2];
162
  uint8_t *buffer_ptr_orig = buffer_ptr;
155 163

  
156 164
  iov[0].iov_base = &my_hdr;
157 165
  iov[0].iov_len = 1;
......
181 189
  memcpy(&(*remote)->addr, &raddr, msg.msg_namelen);
182 190
  (*remote)->fd = -1;
183 191

  
192
  reg_message_recv(recv, buffer_ptr_orig[0]);
193

  
184 194
  return recv;
185 195
}
186 196

  

Also available in: Unified diff