skylark.patch

Using the functionality in Skylark - Jan DolinĂ¡r, 05/30/2013 09:18 PM

Download (1.85 KB)

View differences:

uppsrc/Skylark/App.cpp (working copy)
186 186

  
187 187
	main_pid = getpid();
188 188
	quit = false;
189
	
190
	IpAddrInfo ipinfo;
191
	ipinfo.Execute(ip, port, IpAddrInfo::FAMILY_IPV4);
192
	addrinfo *addr = ipinfo.GetResult();
189 193

  
190 194
#ifdef _DEBUG
191 195
	int qq = 0;
192 196
	for(;;) {
193
		if(server.Listen(port, 5))
197
		if(server.Listen(port, 5, false, true, &(((sockaddr_in*)addr->ai_addr)->sin_addr.s_addr)))
194 198
			break;
195 199
		Cout() << "Trying to start listening (other process using the same port?) " << ++qq << "\n";
196 200
		Sleep(1000);
197 201
	}
198 202
#else
199
	if(!server.Listen(port, 5)) {
203
	if(!server.Listen(port, 5, false, true, &(((sockaddr_in*)addr->ai_addr)->sin_addr.s_addr))) {
200 204
		SKYLARKLOG("Cannot open server socket for listening!");
201 205
		Exit(1);
202 206
	}
......
281 285

  
282 286
namespace Ini {
283 287
INI_INT(port, 8001, "TCP/IP server port to listen on");
288
INI_STRING(ip, "0.0.0.0", "IP address to listen on");
284 289
INI_STRING(path, Nvl(GetEnv("UPP_ASSEMBLY__"), GetFileFolder(GetExeFilePath())), "Path to witz templates and static files");
285 290
INI_INT(threads, 3 * CPU_Cores() + 1, "Number of threads in each Skylark subprocess");
286 291
#ifdef _DEBUG
......
305 310
	app = this;
306 311
	threads = Ini::threads;
307 312
	port = Ini::port;
313
	ip = Ini::ip;
308 314
	use_caching = Ini::use_caching;
309 315
	prefork = Ini::prefork;
310 316
	timeout = Ini::timeout;
uppsrc/Skylark/Skylark.h (working copy)
44 44
	SkylarkSessionConfig      session;
45 45
	int                       threads;
46 46
	int                       port;
47
	String                    ip;
47 48
	int                       prefork;
48 49
	int                       timeout;
49 50
	bool                      use_caching;