Fossil SCM

Make sure the socket of the "ui" and "server" commands is bound to the specified port when the -P or --port option is used. Ticket [7ef970e4a2]

drh 2008-11-19 23:33 trunk
Commit 53db94cd41f9eeaf5e9de68621e327f436d02159
2 files changed +2 -2 +2 -2
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1214,11 +1214,11 @@
12141214
struct timeval delay; /* How long to wait inside select() */
12151215
struct sockaddr_in inaddr; /* The socket address */
12161216
int opt = 1; /* setsockopt flag */
12171217
int iPort = mnPort;
12181218
1219
- while( iPort<mxPort ){
1219
+ while( iPort<=mxPort ){
12201220
memset(&inaddr, 0, sizeof(inaddr));
12211221
inaddr.sin_family = AF_INET;
12221222
inaddr.sin_addr.s_addr = INADDR_ANY;
12231223
inaddr.sin_port = htons(iPort);
12241224
listener = socket(AF_INET, SOCK_STREAM, 0);
@@ -1240,11 +1240,11 @@
12401240
if( iPort>mxPort ){
12411241
if( mnPort==mxPort ){
12421242
fossil_fatal("unable to open listening socket on ports %d", mnPort);
12431243
}else{
12441244
fossil_fatal("unable to open listening socket on any"
1245
- " ports %d..%d", mnPort, mxPort);
1245
+ " port in the range %d..%d", mnPort, mxPort);
12461246
}
12471247
}
12481248
if( iPort>mxPort ) return 1;
12491249
listen(listener,10);
12501250
if( iPort>mnPort ){
12511251
--- src/cgi.c
+++ src/cgi.c
@@ -1214,11 +1214,11 @@
1214 struct timeval delay; /* How long to wait inside select() */
1215 struct sockaddr_in inaddr; /* The socket address */
1216 int opt = 1; /* setsockopt flag */
1217 int iPort = mnPort;
1218
1219 while( iPort<mxPort ){
1220 memset(&inaddr, 0, sizeof(inaddr));
1221 inaddr.sin_family = AF_INET;
1222 inaddr.sin_addr.s_addr = INADDR_ANY;
1223 inaddr.sin_port = htons(iPort);
1224 listener = socket(AF_INET, SOCK_STREAM, 0);
@@ -1240,11 +1240,11 @@
1240 if( iPort>mxPort ){
1241 if( mnPort==mxPort ){
1242 fossil_fatal("unable to open listening socket on ports %d", mnPort);
1243 }else{
1244 fossil_fatal("unable to open listening socket on any"
1245 " ports %d..%d", mnPort, mxPort);
1246 }
1247 }
1248 if( iPort>mxPort ) return 1;
1249 listen(listener,10);
1250 if( iPort>mnPort ){
1251
--- src/cgi.c
+++ src/cgi.c
@@ -1214,11 +1214,11 @@
1214 struct timeval delay; /* How long to wait inside select() */
1215 struct sockaddr_in inaddr; /* The socket address */
1216 int opt = 1; /* setsockopt flag */
1217 int iPort = mnPort;
1218
1219 while( iPort<=mxPort ){
1220 memset(&inaddr, 0, sizeof(inaddr));
1221 inaddr.sin_family = AF_INET;
1222 inaddr.sin_addr.s_addr = INADDR_ANY;
1223 inaddr.sin_port = htons(iPort);
1224 listener = socket(AF_INET, SOCK_STREAM, 0);
@@ -1240,11 +1240,11 @@
1240 if( iPort>mxPort ){
1241 if( mnPort==mxPort ){
1242 fossil_fatal("unable to open listening socket on ports %d", mnPort);
1243 }else{
1244 fossil_fatal("unable to open listening socket on any"
1245 " port in the range %d..%d", mnPort, mxPort);
1246 }
1247 }
1248 if( iPort>mxPort ) return 1;
1249 listen(listener,10);
1250 if( iPort>mnPort ){
1251
+2 -2
--- src/winhttp.c
+++ src/winhttp.c
@@ -144,11 +144,11 @@
144144
int iPort = mnPort;
145145
146146
if( WSAStartup(MAKEWORD(1,1), &wd) ){
147147
fossil_fatal("unable to initialize winsock");
148148
}
149
- while( iPort<mxPort ){
149
+ while( iPort<=mxPort ){
150150
s = socket(AF_INET, SOCK_STREAM, 0);
151151
if( s==INVALID_SOCKET ){
152152
fossil_fatal("unable to create a socket");
153153
}
154154
addr.sin_family = AF_INET;
@@ -169,11 +169,11 @@
169169
if( iPort>mxPort ){
170170
if( mnPort==mxPort ){
171171
fossil_fatal("unable to open listening socket on ports %d", mnPort);
172172
}else{
173173
fossil_fatal("unable to open listening socket on any"
174
- " ports %d..%d", mnPort, mxPort);
174
+ " port in the range %d..%d", mnPort, mxPort);
175175
}
176176
}
177177
zTempPrefix = mprintf("fossil_server_P%d_", iPort);
178178
printf("Listening for HTTP requests on TCP port %d\n", iPort);
179179
if( zBrowser ){
180180
--- src/winhttp.c
+++ src/winhttp.c
@@ -144,11 +144,11 @@
144 int iPort = mnPort;
145
146 if( WSAStartup(MAKEWORD(1,1), &wd) ){
147 fossil_fatal("unable to initialize winsock");
148 }
149 while( iPort<mxPort ){
150 s = socket(AF_INET, SOCK_STREAM, 0);
151 if( s==INVALID_SOCKET ){
152 fossil_fatal("unable to create a socket");
153 }
154 addr.sin_family = AF_INET;
@@ -169,11 +169,11 @@
169 if( iPort>mxPort ){
170 if( mnPort==mxPort ){
171 fossil_fatal("unable to open listening socket on ports %d", mnPort);
172 }else{
173 fossil_fatal("unable to open listening socket on any"
174 " ports %d..%d", mnPort, mxPort);
175 }
176 }
177 zTempPrefix = mprintf("fossil_server_P%d_", iPort);
178 printf("Listening for HTTP requests on TCP port %d\n", iPort);
179 if( zBrowser ){
180
--- src/winhttp.c
+++ src/winhttp.c
@@ -144,11 +144,11 @@
144 int iPort = mnPort;
145
146 if( WSAStartup(MAKEWORD(1,1), &wd) ){
147 fossil_fatal("unable to initialize winsock");
148 }
149 while( iPort<=mxPort ){
150 s = socket(AF_INET, SOCK_STREAM, 0);
151 if( s==INVALID_SOCKET ){
152 fossil_fatal("unable to create a socket");
153 }
154 addr.sin_family = AF_INET;
@@ -169,11 +169,11 @@
169 if( iPort>mxPort ){
170 if( mnPort==mxPort ){
171 fossil_fatal("unable to open listening socket on ports %d", mnPort);
172 }else{
173 fossil_fatal("unable to open listening socket on any"
174 " port in the range %d..%d", mnPort, mxPort);
175 }
176 }
177 zTempPrefix = mprintf("fossil_server_P%d_", iPort);
178 printf("Listening for HTTP requests on TCP port %d\n", iPort);
179 if( zBrowser ){
180

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button