Loading Win32Build/or/or.dsp +18 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\src\win32" /I "D:\openssl\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\src\win32" /I "D:\openssl\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe Loading Loading @@ -95,7 +95,15 @@ SOURCE=..\..\src\or\buffers.c # End Source File # Begin Source File SOURCE=..\..\src\or\circuit.c SOURCE=..\..\src\or\circuitbuild.c # End Source File # Begin Source File SOURCE=..\..\src\or\circuitlist.c # End Source File # Begin Source File SOURCE=..\..\src\or\circuituse.c # End Source File # Begin Source File Loading Loading @@ -155,6 +163,10 @@ SOURCE=..\..\src\or\onion.c # End Source File # Begin Source File SOURCE=..\..\src\or\relay.c # End Source File # Begin Source File SOURCE=..\..\src\or\rendclient.c # End Source File # Begin Source File Loading Loading @@ -183,6 +195,10 @@ SOURCE=..\..\src\or\routerlist.c # End Source File # Begin Source File SOURCE=..\..\src\or\routerparse.c # End Source File # Begin Source File SOURCE=..\..\src\or\tor_main.c # End Source File # Begin Source File Loading src/common/fakepoll.c +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ #include "orconfig.h" #include "fakepoll.h" #define MAXCONNECTIONS 10000 /* XXXX copied from or.h */ #define FD_SETSIZE MAXCONNECTIONS #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif Loading Loading @@ -47,8 +50,6 @@ tor_poll(struct pollfd *ufds, unsigned int nfds, int timeout) } #else #define FD_SETSIZE MAXCONNECTIONS int tor_poll(struct pollfd *ufds, unsigned int nfds, int timeout) { Loading src/common/util.c +50 −0 Original line number Diff line number Diff line Loading @@ -1730,6 +1730,56 @@ int tor_lookup_hostname(const char *name, uint32_t *addr) } } #ifndef MS_WINDOWS struct tor_mutex_t { }; tor_mutex_t *tor_mutex_new(void) { return NULL; } void tor_mutex_acquire(tor_mutex_t *m) { } void tor_mutex_release(tor_mutex_t *m) { } void tor_mutex_free(tor_mutex_t *m) { } #else struct tor_mutex_t { HANDLE handle; }; tor_mutex_t *tor_mutex_new(void) { tor_mutex_t *m; m = tor_malloc_zero(sizeof(tor_mutex_t)); m->handle = CreateMutex(NULL, FALSE, NULL); tor_assert(m->handle != NULL); return m; } void tor_mutex_free(tor_mutex_t *m) { CloseHandle(m->handle); tor_free(m); } void tor_mutex_acquire(tor_mutex_t *m) { DWORD r; r = WaitForSingleObject(m->handle, INFINITE); switch (r) { case WAIT_ABANDONED: /* holding thread exited. */ case WAIT_OBJECT_0: /* we got the mutex normally. */ break; case WAIT_TIMEOUT: /* Should never happen. */ tor_assert(0); break; case WAIT_FAILED: log_fn(LOG_WARN, "Failed to acquire mutex: %d", GetLastError()); } } void tor_mutex_release(tor_mutex_t *m) { BOOL r; r = ReleaseMutex(m->handle); if (!r) { log_fn(LOG_WARN, "Failed to release mutex: %d", GetLastError()); } } #endif /* Local Variables: mode:c Loading src/common/util.h +8 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,14 @@ int parse_line_from_file(char *line, int maxlen, FILE *f, char **key_out, char * int spawn_func(int (*func)(void *), void *data); void spawn_exit(); /* Because we use threads instead of processes on Windows, we need locking on Windows. * On Unixy platforms, these functions are no-ops. */ typedef struct tor_mutex_t tor_mutex_t; tor_mutex_t *tor_mutex_new(void); void tor_mutex_acquire(tor_mutex_t *m); void tor_mutex_release(tor_mutex_t *m); void tor_mutex_free(tor_mutex_t *m); int tor_socketpair(int family, int type, int protocol, int fd[2]); int is_internal_IP(uint32_t ip); Loading src/or/connection.c +1 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,7 @@ static int connection_create_listener(const char *bindaddress, uint16_t bindport memset(&bindaddr,0,sizeof(struct sockaddr_in)); bindaddr.sin_family = AF_INET; bindaddr.sin_port = htons(usePort); bindaddr.sin_port = htons((uint16_t) usePort); if(tor_lookup_hostname(hostname, &(bindaddr.sin_addr.s_addr)) != 0) { log_fn(LOG_WARN,"Can't resolve BindAddress %s",hostname); tor_free(hostname); Loading Loading
Win32Build/or/or.dsp +18 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\src\win32" /I "D:\openssl\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\src\win32" /I "D:\openssl\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe Loading Loading @@ -95,7 +95,15 @@ SOURCE=..\..\src\or\buffers.c # End Source File # Begin Source File SOURCE=..\..\src\or\circuit.c SOURCE=..\..\src\or\circuitbuild.c # End Source File # Begin Source File SOURCE=..\..\src\or\circuitlist.c # End Source File # Begin Source File SOURCE=..\..\src\or\circuituse.c # End Source File # Begin Source File Loading Loading @@ -155,6 +163,10 @@ SOURCE=..\..\src\or\onion.c # End Source File # Begin Source File SOURCE=..\..\src\or\relay.c # End Source File # Begin Source File SOURCE=..\..\src\or\rendclient.c # End Source File # Begin Source File Loading Loading @@ -183,6 +195,10 @@ SOURCE=..\..\src\or\routerlist.c # End Source File # Begin Source File SOURCE=..\..\src\or\routerparse.c # End Source File # Begin Source File SOURCE=..\..\src\or\tor_main.c # End Source File # Begin Source File Loading
src/common/fakepoll.c +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ #include "orconfig.h" #include "fakepoll.h" #define MAXCONNECTIONS 10000 /* XXXX copied from or.h */ #define FD_SETSIZE MAXCONNECTIONS #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif Loading Loading @@ -47,8 +50,6 @@ tor_poll(struct pollfd *ufds, unsigned int nfds, int timeout) } #else #define FD_SETSIZE MAXCONNECTIONS int tor_poll(struct pollfd *ufds, unsigned int nfds, int timeout) { Loading
src/common/util.c +50 −0 Original line number Diff line number Diff line Loading @@ -1730,6 +1730,56 @@ int tor_lookup_hostname(const char *name, uint32_t *addr) } } #ifndef MS_WINDOWS struct tor_mutex_t { }; tor_mutex_t *tor_mutex_new(void) { return NULL; } void tor_mutex_acquire(tor_mutex_t *m) { } void tor_mutex_release(tor_mutex_t *m) { } void tor_mutex_free(tor_mutex_t *m) { } #else struct tor_mutex_t { HANDLE handle; }; tor_mutex_t *tor_mutex_new(void) { tor_mutex_t *m; m = tor_malloc_zero(sizeof(tor_mutex_t)); m->handle = CreateMutex(NULL, FALSE, NULL); tor_assert(m->handle != NULL); return m; } void tor_mutex_free(tor_mutex_t *m) { CloseHandle(m->handle); tor_free(m); } void tor_mutex_acquire(tor_mutex_t *m) { DWORD r; r = WaitForSingleObject(m->handle, INFINITE); switch (r) { case WAIT_ABANDONED: /* holding thread exited. */ case WAIT_OBJECT_0: /* we got the mutex normally. */ break; case WAIT_TIMEOUT: /* Should never happen. */ tor_assert(0); break; case WAIT_FAILED: log_fn(LOG_WARN, "Failed to acquire mutex: %d", GetLastError()); } } void tor_mutex_release(tor_mutex_t *m) { BOOL r; r = ReleaseMutex(m->handle); if (!r) { log_fn(LOG_WARN, "Failed to release mutex: %d", GetLastError()); } } #endif /* Local Variables: mode:c Loading
src/common/util.h +8 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,14 @@ int parse_line_from_file(char *line, int maxlen, FILE *f, char **key_out, char * int spawn_func(int (*func)(void *), void *data); void spawn_exit(); /* Because we use threads instead of processes on Windows, we need locking on Windows. * On Unixy platforms, these functions are no-ops. */ typedef struct tor_mutex_t tor_mutex_t; tor_mutex_t *tor_mutex_new(void); void tor_mutex_acquire(tor_mutex_t *m); void tor_mutex_release(tor_mutex_t *m); void tor_mutex_free(tor_mutex_t *m); int tor_socketpair(int family, int type, int protocol, int fd[2]); int is_internal_IP(uint32_t ip); Loading
src/or/connection.c +1 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,7 @@ static int connection_create_listener(const char *bindaddress, uint16_t bindport memset(&bindaddr,0,sizeof(struct sockaddr_in)); bindaddr.sin_family = AF_INET; bindaddr.sin_port = htons(usePort); bindaddr.sin_port = htons((uint16_t) usePort); if(tor_lookup_hostname(hostname, &(bindaddr.sin_addr.s_addr)) != 0) { log_fn(LOG_WARN,"Can't resolve BindAddress %s",hostname); tor_free(hostname); Loading