mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Make windows version correct; initialize windows foolishness so that gethostbyname works.
svn:r1250
This commit is contained in:
parent
c230132562
commit
d877aac5ad
@ -695,12 +695,42 @@ static void dumpstats(int severity) {
|
|||||||
(int) (stats_n_bytes_read/stats_n_seconds_reading));
|
(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 tor_main(int argc, char *argv[]) {
|
int tor_main(int argc, char *argv[]) {
|
||||||
|
|
||||||
/* give it somewhere to log to initially */
|
/* give it somewhere to log to initially */
|
||||||
add_stream_log(LOG_INFO, "<stdout>", stdout);
|
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);
|
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 (init_from_config(argc,argv) < 0)
|
if (init_from_config(argc,argv) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@
|
|||||||
#define STDC_HEADERS
|
#define STDC_HEADERS
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "0.0.2pre6"
|
#define VERSION "0.0.2pre26"
|
||||||
|
|
||||||
/* XXXX WWWW */
|
/* XXXX WWWW */
|
||||||
#define CONFDIR ""
|
#define CONFDIR ""
|
||||||
|
Loading…
Reference in New Issue
Block a user