[or-cvs] UnDOSify CRLF->LF.
Nick Mathewson
nickm at seul.org
Thu Mar 11 06:22:55 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv3984/src/or
Modified Files:
buffers.c connection.c directory.c main.c or.h routerlist.c
Log Message:
UnDOSify CRLF->LF.
Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- buffers.c 11 Mar 2004 06:19:08 -0000 1.70
+++ buffers.c 11 Mar 2004 06:22:53 -0000 1.71
@@ -193,8 +193,8 @@
if(!ERRNO_EAGAIN(errno)) { /* it's a real error */
return -1;
}
-#ifdef MS_WINDOWS
- e = correct_socket_errno(s);
+#ifdef MS_WINDOWS
+ e = correct_socket_errno(s);
if(!ERRNO_EAGAIN(e)) { /* no, it *is* a real error! */
return -1;
}
@@ -249,14 +249,14 @@
if(*buf_flushlen == 0) /* nothing to flush */
return 0;
-
+
write_result = send(s, buf->mem, *buf_flushlen, 0);
if (write_result < 0) {
if(!ERRNO_EAGAIN(errno)) { /* it's a real error */
return -1;
}
-#ifdef MS_WINDOWS
- e = correct_socket_errno(s);
+#ifdef MS_WINDOWS
+ e = correct_socket_errno(s);
if(!ERRNO_EAGAIN(e)) { /* no, it *is* a real error! */
return -1;
}
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- connection.c 11 Mar 2004 06:19:08 -0000 1.179
+++ connection.c 11 Mar 2004 06:22:53 -0000 1.180
@@ -226,7 +226,7 @@
if (conn->hold_open_until_flushed) {
assert(conn->marked_for_close);
if (now - conn->timestamp_lastwritten >= 15) {
- log_fn(LOG_WARN,"Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %d).",
+ log_fn(LOG_WARN,"Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %d).",
conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state);
conn->hold_open_until_flushed = 0;
}
@@ -611,7 +611,7 @@
*/
}
} else {
- if (flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen) < 0) {
+ if (flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen) < 0) {
connection_close_immediate(conn); /* Don't flush; connection is dead. */
connection_mark_for_close(conn, END_STREAM_REASON_MISC);
return -1;
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- directory.c 11 Mar 2004 06:19:08 -0000 1.62
+++ directory.c 11 Mar 2004 06:22:53 -0000 1.63
@@ -46,12 +46,12 @@
}
switch(connection_connect(conn, router->address, router->addr, router->dir_port)) {
- case -1:
+ case -1:
router_mark_as_down(conn->nickname); /* don't try him again */
connection_remove(conn);
connection_free(conn);
return;
- case 0:
+ case 0:
connection_set_poll_socket(conn);
connection_watch_events(conn, POLLIN | POLLOUT | POLLERR);
/* writable indicates finish, readable indicates broken link,
@@ -59,7 +59,7 @@
conn->state = command;
return;
/* case 1: fall through */
- }
+ }
connection_set_poll_socket(conn);
if(directory_send_command(conn, command) < 0) {
@@ -237,7 +237,7 @@
int e, len=sizeof(e);
assert(conn && conn->type == CONN_TYPE_DIR);
-
+
switch(conn->state) {
case DIR_CONN_STATE_CONNECTING_FETCH:
case DIR_CONN_STATE_CONNECTING_UPLOAD:
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- main.c 11 Mar 2004 06:19:08 -0000 1.197
+++ main.c 11 Mar 2004 06:22:53 -0000 1.198
@@ -69,7 +69,7 @@
nfds++;
- log(LOG_INFO,"connection_add(): new conn type %s, socket %d, nfds %d.",
+ log(LOG_INFO,"connection_add(): new conn type %s, socket %d, nfds %d.",
CONN_TYPE_TO_STRING(conn->type), conn->s, nfds);
return 0;
@@ -89,7 +89,7 @@
assert(conn);
assert(nfds>0);
- log_fn(LOG_INFO,"removing socket %d (type %s), nfds now %d",
+ log_fn(LOG_INFO,"removing socket %d (type %s), nfds now %d",
conn->s, CONN_TYPE_TO_STRING(conn->type), nfds-1);
/* if it's an edge conn, remove it from the list
* of conn's on this circuit. If it's not on an edge,
@@ -176,7 +176,7 @@
if(!(poll_array[i].revents & (POLLIN|POLLHUP|POLLERR)))
if(!connection_is_reading(conn) ||
!connection_has_pending_tls_data(conn))
- return; /* this conn should not read */
+ return; /* this conn should not read */
log_fn(LOG_DEBUG,"socket %d wants to read.",conn->s);
@@ -204,7 +204,7 @@
connection_t *conn;
if(!(poll_array[i].revents & POLLOUT))
- return; /* this conn doesn't want to write */
+ return; /* this conn doesn't want to write */
conn = connection_array[i];
log_fn(LOG_DEBUG,"socket %d wants to write.",conn->s);
@@ -696,42 +696,42 @@
log(severity,"Average bandwidth used: %d bytes/sec",
(int) (stats_n_bytes_read/stats_n_seconds_reading));
}
-
-int network_init(void)
-{
-#ifdef MS_WINDOWS
- /* This silly exercise is necessary before windows will allow gethostbyname to work.
- */
- WSADATA WSAData;
- int r;
- r = WSAStartup(0x101,&WSAData);
- if (r) {
- log_fn(LOG_WARN,"Error initializing windows network layer: code was %d",r);
- return -1;
- }
- /* XXXX We should call WSACleanup on exit, I think. */
-#endif
- return 0;
-}
-
-void exit_function(void)
-{
-#ifdef MS_WINDOWS
- WSACleanup();
-#endif
-}
+
+int network_init(void)
+{
+#ifdef MS_WINDOWS
+ /* This silly exercise is necessary before windows will allow gethostbyname to work.
+ */
+ WSADATA WSAData;
+ int r;
+ r = WSAStartup(0x101,&WSAData);
+ if (r) {
+ log_fn(LOG_WARN,"Error initializing windows network layer: code was %d",r);
+ return -1;
+ }
+ /* XXXX We should call WSACleanup on exit, I think. */
+#endif
+ return 0;
+}
+
+void exit_function(void)
+{
+#ifdef MS_WINDOWS
+ WSACleanup();
+#endif
+}
int tor_main(int argc, char *argv[]) {
/* give it somewhere to log to initially */
add_stream_log(LOG_INFO, "<stdout>", stdout);
log_fn(LOG_WARN,"Tor v%s. This is experimental software. Do not use it if you need anonymity.",VERSION);
-
- if (network_init()<0) {
- log_fn(LOG_ERR,"Error initializing network; exiting.");
- return 1;
- }
- atexit(exit_function);
+
+ if (network_init()<0) {
+ log_fn(LOG_ERR,"Error initializing network; exiting.");
+ return 1;
+ }
+ atexit(exit_function);
if (init_from_config(argc,argv) < 0)
return -1;
@@ -739,8 +739,8 @@
#ifndef MS_WINDOWS
if(geteuid()==0)
log_fn(LOG_WARN,"You are running Tor as root. You don't need to, and you probably shouldn't.");
-#endif
-
+#endif
+
if(options.ORPort) { /* only spawn dns handlers if we're a router */
dns_init(); /* initialize the dns resolve tree, and spawn workers */
}
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.250
retrieving revision 1.251
diff -u -d -r1.250 -r1.251
--- or.h 11 Mar 2004 06:19:08 -0000 1.250
+++ or.h 11 Mar 2004 06:22:53 -0000 1.251
@@ -3,15 +3,15 @@
/* $Id$ */
#ifndef __OR_H
-#define __OR_H
+#define __OR_H
-#include "orconfig.h"
-#ifdef MS_WINDOWS
-#define WIN32_WINNT 0x400
-#define _WIN32_WINNT 0x400
-#define WIN32_LEAN_AND_MEAN
-/* Number of fds that select will accept; default is 64. */
-#define FD_SETSIZE 512
+#include "orconfig.h"
+#ifdef MS_WINDOWS
+#define WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x400
+#define WIN32_LEAN_AND_MEAN
+/* Number of fds that select will accept; default is 64. */
+#define FD_SETSIZE 512
#endif
#include <stdio.h>
@@ -662,12 +662,12 @@
int config_assign_default_dirservers(void);
int getconfig(int argc, char **argv, or_options_t *options);
-/********************************* connection.c ***************************/
-
-#define CONN_TYPE_TO_STRING(t) (((t) < _CONN_TYPE_MIN || (t) > _CONN_TYPE_MAX) ? "Unknown" : \
- conn_type_to_string[(t)])
-
-extern char *conn_type_to_string[];
+/********************************* connection.c ***************************/
+
+#define CONN_TYPE_TO_STRING(t) (((t) < _CONN_TYPE_MIN || (t) > _CONN_TYPE_MAX) ? "Unknown" : \
+ conn_type_to_string[(t)])
+
+extern char *conn_type_to_string[];
connection_t *connection_new(int type);
void connection_free(connection_t *conn);
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- routerlist.c 11 Mar 2004 06:19:08 -0000 1.37
+++ routerlist.c 11 Mar 2004 06:22:53 -0000 1.38
@@ -390,7 +390,7 @@
if (router_resolve_routerlist(routerlist)) {
log_fn(LOG_WARN, "Error resolving routerlist");
return -1;
- }
+ }
if (compare_recommended_versions(VERSION, routerlist->software_versions) < 0) {
log(options.IgnoreVersion ? LOG_WARN : LOG_ERR,
"You are running Tor version %s, which will not work with this network.\n"
@@ -551,12 +551,12 @@
#else
unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
if (sscanf(cp, "%u-%u-%u %u:%u:%u", &year, &month,
- &day, &hour, &minute, &second) < 6) {
- log_fn(LOG_WARN, "Published time was unparseable"); return -1;
+ &day, &hour, &minute, &second) < 6) {
+ log_fn(LOG_WARN, "Published time was unparseable"); return -1;
}
if (year < 1970 || month < 1 || month > 12 || day < 1 || day > 31 ||
- hour > 23 || minute > 59 || second > 61) {
- log_fn(LOG_WARN, "Published time was nonsensical"); return -1;
+ hour > 23 || minute > 59 || second > 61) {
+ log_fn(LOG_WARN, "Published time was nonsensical"); return -1;
}
st_tm.tm_year = year;
st_tm.tm_mon = month-1;
@@ -903,7 +903,7 @@
}
assert(tok->n_args == 1);
if (parse_time(tok->args[0], &router->published_on) < 0)
- goto err;
+ goto err;
if (!(tok = find_first_by_keyword(tokens, K_ONION_KEY))) {
log_fn(LOG_WARN, "Missing onion key"); goto err;
More information about the tor-commits
mailing list