This patch makes git-daemon --verbose log some useful things on stderr -
in particular connects, disconnects and upload requests, and in such a
way to be able to trace a particular session. Some more errors are now
also logged (even when --verbose is not passed). It is still not perfect
since messages produced by the non-daemon-specific code are obviously
not formatted properly.
[jc: With minor fix up in the log line truncation, and
use of write(2) as suggested by Linus.]
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This should work around the compilation problem Johannes Schindelin
and others had on Mac OS/X.
Quoting Linus:
Any operating system where socklen_t is anything else than "int" is
terminally broken. The people who introduced that typedef were confused,
and I actually had to argue with them that it was fundamentally wrong:
there is no other valid type than "int" that makes sense for it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-daemon using inetd. does not work properly. inetd routes stderr onto the
network line just like stdout, which was apparently not expected to be so.
As the result of this, the stream is closed by the receiver, because some
"Packing %d objects\n" originating from pack_objects is first reported over
the line instead of the expected pack_header, and so the SIGNATURE test
fails. Here is a workaround.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Every time after servicing the connection, select() first fails
with EINTR and ends up waiting for one second before serving the
next client. The sleep() was placed by the original author per
suggestion from the list to avoid spinning on failing select,
but at least this EINTR situation should not result in "at most
one client per second" service limit.
I am not sure if this is the right fix, but WTH. The king
penguin says that serious people would run the daemon under
inetd anyway, and I agree with that.
Signed-off-by: Junio C Hamano <junkio@cox.net>
A few sparse warnings have crept in again since I checked last time:
undeclared variables with global scope.
Fix them by marking the private variables properly "static".
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Shut down connections that haven't even identified themselves as git
clients first. That should get rid of people who just connect to the
port and wait for something to happen.
This is using a lockless approach that allows us to handle children
dying without having to block SIGCHLD.
Right now our "solution" to too many kids is pretty damn rough, but it
at least shows what you can do.
Alexey Nezhdanov sent a patch that made git-daemon usable from inetd (ie
where inetd has already done the accept on the new connection, the fork,
and the setup of stdin/stdout). I wanted to organize the thing slightly
differently, though.