krb5 commit: Fix sentinel position in sample u2u server
Greg Hudson
ghudson at MIT.EDU
Thu Jun 13 11:13:08 EDT 2013
https://github.com/krb5/krb5/commit/0903006d9aef36b58d6ee7dfa5b10771add92279
commit 0903006d9aef36b58d6ee7dfa5b10771add92279
Author: Greg Hudson <ghudson at mit.edu>
Date: Thu Jun 13 11:06:23 2013 -0400
Fix sentinel position in sample u2u server
Print "Server started" after calling listen(), or there wil be a race
where the client tries to connect before there is a listen queue and
gets ECONNREFUSED.
src/appl/user_user/server.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/appl/user_user/server.c b/src/appl/user_user/server.c
index 3c844d8..dbff68e 100644
--- a/src/appl/user_user/server.c
+++ b/src/appl/user_user/server.c
@@ -95,14 +95,14 @@ int main(argc, argv)
com_err("uu-server", errno, "binding socket");
exit(3);
}
-
- printf("Server started\n");
- fflush(stdout);
-
if (listen(sock, 1) == -1) {
com_err("uu-server", errno, "listening");
exit(3);
}
+
+ printf("Server started\n");
+ fflush(stdout);
+
if ((acc = accept(sock, (struct sockaddr *)&f_inaddr, &namelen)) == -1) {
com_err("uu-server", errno, "accepting");
exit(3);
More information about the cvs-krb5
mailing list