git://git.onelab.eu
/
codemux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5723879
)
introduce an IP field to bind
author
S.Çağlar Onur
<caglar@cs.princeton.edu>
Tue, 9 Mar 2010 20:22:11 +0000
(20:22 +0000)
committer
S.Çağlar Onur
<caglar@cs.princeton.edu>
Tue, 9 Mar 2010 20:22:11 +0000
(20:22 +0000)
codemux.c
patch
|
blob
|
history
diff --git
a/codemux.c
b/codemux.c
index
5957850
..
0b6233c
100644
(file)
--- a/
codemux.c
+++ b/
codemux.c
@@
-64,6
+64,7
@@
typedef struct ServiceSig {
char *ss_host; /* suffix in host */
char *ss_slice;
short ss_port;
char *ss_host; /* suffix in host */
char *ss_slice;
short ss_port;
+ char *ss_ip;
int ss_slicePos; /* position in slices array */
} ServiceSig;
int ss_slicePos; /* position in slices array */
} ServiceSig;
@@
-312,6
+313,7
@@
ReadConfFile(void)
serv.ss_host = GetWord(line, 0);
serv.ss_slice = GetWord(line, 1);
serv.ss_host = GetWord(line, 0);
serv.ss_slice = GetWord(line, 1);
+ serv.ss_ip = GetWord(line, 3);
if (num == 0) {
/* the first row must be an entry for apache */
if (num == 0) {
/* the first row must be an entry for apache */
@@
-358,6
+360,7
@@
ReadConfFile(void)
for (i = 0; i < numServices; i++) {
xfree(serviceSig[i].ss_host);
for (i = 0; i < numServices; i++) {
xfree(serviceSig[i].ss_host);
+ xfree(serviceSig[i].ss_ip);
xfree(serviceSig[i].ss_slice);
}
xfree(serviceSig);
xfree(serviceSig[i].ss_slice);
}
xfree(serviceSig);
@@
-566,8
+569,12
@@
StartConnect(int origFD, int whichService)
memset(&dest, 0, sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_port = htons(serviceSig[whichService].ss_port);
memset(&dest, 0, sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_port = htons(serviceSig[whichService].ss_port);
- dest.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
+ if (serviceSig[whichService].ss_ip != NULL) {
+ dest.sin_addr.s_addr = inet_addr(serviceSig[whichService].ss_ip);
+ } else {
+ dest.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ }
+
/* start connection process - we should be told that it's in
progress */
if (connect(sock, (struct sockaddr *) &dest, sizeof(dest)) != -1 ||
/* start connection process - we should be told that it's in
progress */
if (connect(sock, (struct sockaddr *) &dest, sizeof(dest)) != -1 ||