~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pkstream/pkstream.c: Set a flag if we're listening.
[tripe]
/
pkstream
/
pkstream.c
diff --git
a/pkstream/pkstream.c
b/pkstream/pkstream.c
index
f1ddf77
..
b291a1c
100644
(file)
--- a/
pkstream/pkstream.c
+++ b/
pkstream/pkstream.c
@@
-73,6
+73,8
@@
typedef struct pkstream {
} pkstream;
typedef struct connwait {
} pkstream;
typedef struct connwait {
+ unsigned f; /* Various flags */
+#define cwf_port 1u /* Port is defined => listen */
sel_file a; /* Selector */
struct sockaddr_in me, peer; /* Who I'm meant to be; who peer is */
} connwait;
sel_file a; /* Selector */
struct sockaddr_in me, peer; /* Who I'm meant to be; who peer is */
} connwait;
@@
-115,7
+117,7
@@
static void doclose(pkstream *p)
xfree(pk);
}
xfree(p);
xfree(pk);
}
xfree(p);
- if (cw.
me.sin
_port) dolisten();
+ if (cw.
f&cwf
_port) dolisten();
else exit(0);
}
else exit(0);
}
@@
-337,6
+339,8
@@
int main(int argc, char *argv[])
#define f_bogus 1u
#define f_bogus 1u
+ cw.f = 0;
+
ego(argv[0]);
sel_init(&sel);
for (;;) {
ego(argv[0]);
sel_init(&sel);
for (;;) {
@@
-375,11
+379,14
@@
int main(int argc, char *argv[])
if (bindsvc && connhost)
die(1, "can't listen and connect");
if (bindsvc && connhost)
die(1, "can't listen and connect");
- initaddr(&cw.me);
if (bindhost || bindsvc) {
initaddr(&bindaddr);
if (!bindsvc) parseaddr(bindhost, 0, 0, &bindaddr);
if (bindhost || bindsvc) {
initaddr(&bindaddr);
if (!bindsvc) parseaddr(bindhost, 0, 0, &bindaddr);
- else parseaddr(bindhost, bindsvc, 0, &cw.me);
+ else {
+ initaddr(&cw.me);
+ parseaddr(bindhost, bindsvc, 0, &cw.me);
+ cw.f |= cwf_port;
+ }
}
initaddr(&cw.peer);
}
initaddr(&cw.peer);