int r, i, different, this_saddrlen;
const char *emsg;
int r, i, different, this_saddrlen;
const char *emsg;
setnonblock(public_local_fd,1);
this_saddrlen= sizeof(this_saddr);
setnonblock(public_local_fd,1);
this_saddrlen= sizeof(this_saddr);
- r= recvfrom(public_local_fd, buf_in.base, buffer_size-1, 0,
+ r= recvfrom(public_local_fd, buf_in.start, buf_in.size, 0,
&this_saddr, &this_saddrlen);
if (!r) { diag("empty ciphertext"); return; }
&this_saddr, &this_saddrlen);
if (!r) { diag("empty ciphertext"); return; }
programid, (unsigned long)this_saddr.sin_family);
return;
}
assert(this_saddrlen == sizeof(this_saddr));
programid, (unsigned long)this_saddr.sin_family);
return;
}
assert(this_saddrlen == sizeof(this_saddr));
for (i=n_mechs-1; i>=0; i--) {
emsg= mechs[i]->decode(md_in[i],&buf_in);
if (emsg) {
for (i=n_mechs-1; i>=0; i--) {
emsg= mechs[i]->decode(md_in[i],&buf_in);
if (emsg) {
- different= !public_remote_specd ||
- memcmp(&this_saddr,&public_remote,sizeof(this_saddr));
+ different= (!public_remote_specd ||
+ public_remote.sin_addr.s_addr != this_saddr.sin_addr.s_addr ||
+ public_remote.sin_port != this_saddr.sin_port);
setnonblock(private_in_fd,0);
write_must(private_in_fd, buf_in.start, buf_in.size, "write down");
setnonblock(private_in_fd,0);
write_must(private_in_fd, buf_in.start, buf_in.size, "write down");
after_eaten= accum_buf;
while ((delim= memchr(after_eaten, 0300, accum_used))) {
this_packet= delim - after_eaten;
after_eaten= accum_buf;
while ((delim= memchr(after_eaten, 0300, accum_used))) {
this_packet= delim - after_eaten;
- if (pollfds[0].revents & POLLIN) inbound();
- if (pollfds[1].revents & POLLOUT) outbound();
+ if (pollfds[0].revents & (POLLIN|POLLERR)) inbound();
+ if (pollfds[1].revents & (POLLIN|POLLERR)) outbound();