Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:JavaCzar:proxychains
proxychains
proxychains-signals.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File proxychains-signals.patch of Package proxychains
diff -urw proxychains-3.1/proxychains/core.c proxychains-3.1-cc1/proxychains/core.c --- proxychains-3.1/proxychains/core.c 2006-03-15 08:16:59.000000000 -0800 +++ proxychains-3.1-cc1/proxychains/core.c 2008-10-13 20:31:21.000000000 -0700 @@ -43,6 +43,33 @@ static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static int poll_retry(struct pollfd *fds, nfds_t nfsd, int timeout) +{ + int ret; + int time_remain = timeout; + int time_elapsed = 0; + + struct timeval start_time; + struct timeval tv; + + gettimeofday(&start_time, NULL); + + do + { + //printf("Retry %d\n", time_remain); + ret = poll(fds, nfsd, time_remain); + gettimeofday(&tv, NULL); + time_elapsed = ((tv.tv_sec - start_time.tv_sec) * 1000 + (tv.tv_usec - start_time.tv_usec) / 1000); + //printf("Time elapsed %d\n", time_elapsed); + time_remain = timeout - time_elapsed; + } + while (ret == -1 && errno == EINTR && time_remain > 0); + //if (ret == -1) + //printf("Return %d %d %s\n", ret, errno, strerror(errno)); + return ret; +} + + static void encode_base_64(char* src,char* dest,int max_len) { int n,l,i; @@ -123,7 +150,7 @@ for(i=0;i<size-1;i++) { pfd[0].revents=0; - ready=poll(pfd,1,tcp_read_time_out); + ready=poll_retry(pfd,1,tcp_read_time_out); if(ready!=1 || !(pfd[0].revents&POLLIN) || 1!=read(fd,&buff[i],1)) return -1; else if(buff[i]=='\n') @@ -145,7 +172,7 @@ for(i=0;i<size;i++) { pfd[0].revents=0; - ready=poll(pfd,1,tcp_read_time_out); + ready=poll_retry(pfd,1,tcp_read_time_out); if(ready!=1 || !(pfd[0].revents&POLLIN) || 1!=read(fd,&buff[i],1)) return -1; } @@ -164,7 +191,7 @@ // printf("\nconnect ret=%d\n",ret);fflush(stdout); if(ret==-1 && errno==EINPROGRESS) { - ret=poll(pfd,1,tcp_connect_time_out); + ret=poll_retry(pfd,1,tcp_connect_time_out); // printf("\npoll ret=%d\n",ret);fflush(stdout); if(ret==1) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor