rem: pf.events=POLLIN;
add: pf.events=POLLOUT;
context: int tsend_dgram(int fd, char* buf, unsigned int len, int timeout,				const struct sockaddr* to, socklen_t tolen){	int n;	int written;	int initial_len;	struct pollfd pf;		written=0;	initial_len=len;	pf.fd=fd;	pf.events=POLLIN;	again:	n=sendto(fd, buf, len, 0, to, tolen);	if (n<0){		if (errno==EINTR) goto again;		else if (errno!=EAGAIN && errno!=EWOULDBLOCK){			LOG(L_ERR, "ERROR: tsend_dgram: failed to send: (%d) %s\n",						errno, strerror(errno));			goto error;		}	}	written+=n;	if (n<len){		/* partial write */		LOG(L_CRIT, "BUG: tsend_dgram: partial write on datagram socket\n");		goto error;	}else{		/* succesfull full write */		goto end;	}	while(1){		pf.revents=0;		n=poll(&pf, 1, timeout);		if (n<0){			if (errno==EINTR) continue; /* signal, ignore */			LOG(L_ERR, "ERROR: tsend_dgram: poll failed: %s [%d]\n",					strerror(errno), errno);			goto error;		}else if (n==0){			/* timeout */			LOG(L_ERR, "ERROR: tsend_dgram: send timeout (%d)\n", timeout);			goto error;		}		if (pf.revents&POLLIN){			/* we can write again */			goto again;		}	}error:	return -1;end:	return written;}