[or-cvs] Make all the other read/writes into recv/sends, except when...

Nick Mathewson nickm at seul.org
Thu Mar 11 06:35:06 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv4626/src/or

Modified Files:
	cpuworker.c dns.c 
Log Message:
Make all the other read/writes into recv/sends, except when they shouldn't be.


Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cpuworker.c	6 Mar 2004 01:43:37 -0000	1.25
+++ cpuworker.c	11 Mar 2004 06:35:03 -0000	1.26
@@ -132,19 +132,19 @@
 
   for(;;) {
 
-    if(read(fd, &question_type, 1) != 1) {
+    if(recv(fd, &question_type, 1, 0) != 1) {
 //      log_fn(LOG_ERR,"read type failed. Exiting.");
       log_fn(LOG_INFO,"cpuworker exiting because tor process died.");
       spawn_exit();
     }
     assert(question_type == CPUWORKER_TASK_ONION);
 
-    if(read_all(fd, tag, TAG_LEN) != TAG_LEN) {
+    if(read_all(fd, tag, TAG_LEN, 1) != TAG_LEN) {
       log_fn(LOG_ERR,"read tag failed. Exiting.");
       spawn_exit();
     }
 
-    if(read_all(fd, question, ONIONSKIN_CHALLENGE_LEN) != ONIONSKIN_CHALLENGE_LEN) {
+    if(read_all(fd, question, ONIONSKIN_CHALLENGE_LEN, 1) != ONIONSKIN_CHALLENGE_LEN) {
       log_fn(LOG_ERR,"read question failed. Exiting.");
       spawn_exit();
     }
@@ -163,7 +163,7 @@
         memcpy(buf+1+TAG_LEN,reply_to_proxy,ONIONSKIN_REPLY_LEN);
         memcpy(buf+1+TAG_LEN+ONIONSKIN_REPLY_LEN,keys,40+32);
       }
-      if(write_all(fd, buf, LEN_ONION_RESPONSE) != LEN_ONION_RESPONSE) {
+      if(write_all(fd, buf, LEN_ONION_RESPONSE, 1) != LEN_ONION_RESPONSE) {
         log_fn(LOG_ERR,"writing response buf failed. Exiting.");
         spawn_exit();
       }

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- dns.c	6 Mar 2004 01:43:37 -0000	1.64
+++ dns.c	11 Mar 2004 06:35:03 -0000	1.65
@@ -397,14 +397,14 @@
 
   for(;;) {
 
-    if(read(fd, &address_len, 1) != 1) {
+    if(recv(fd, &address_len, 1, 0) != 1) {
 //      log_fn(LOG_INFO,"read length failed. Child exiting.");
       log_fn(LOG_INFO,"dnsworker exiting because tor process died.");
       spawn_exit();
     }
     assert(address_len > 0);
 
-    if(read_all(fd, address, address_len) != address_len) {
+    if(read_all(fd, address, address_len, 1) != address_len) {
       log_fn(LOG_ERR,"read hostname failed. Child exiting.");
       spawn_exit();
     }
@@ -413,13 +413,13 @@
     rent = gethostbyname(address);
     if (!rent) {
       log_fn(LOG_INFO,"Could not resolve dest addr %s. Returning nulls.",address);
-      if(write_all(fd, "\0\0\0\0", 4) != 4) {
+      if(write_all(fd, "\0\0\0\0", 4, 1) != 4) {
         log_fn(LOG_ERR,"writing nulls failed. Child exiting.");
         spawn_exit();
       }
     } else {
       assert(rent->h_length == 4); /* break to remind us if we move away from ipv4 */
-      if(write_all(fd, rent->h_addr, 4) != 4) {
+      if(write_all(fd, rent->h_addr, 4, 1) != 4) {
         log_fn(LOG_INFO,"writing answer failed. Child exiting.");
         spawn_exit();
       }



More information about the tor-commits mailing list