Optimize those services that send only one block of data: use send(2)
with the MSG_EOF flag set instead of write(2). Submitted by: David Malone <dwmalone@maths.tcd.ie> Reviewed by: wollman
This commit is contained in:
parent
2d4574973b
commit
a3ad0852cc
@ -219,7 +219,7 @@ daytime_stream(s, sep) /* Return human-readable time of day */
|
||||
clock = time((time_t *) 0);
|
||||
|
||||
(void) sprintf(buffer, "%.24s\r\n", ctime(&clock));
|
||||
(void) write(s, buffer, strlen(buffer));
|
||||
(void) send(s, buffer, strlen(buffer), MSG_EOF);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -320,7 +320,7 @@ iderror(lport, fport, s, er) /* Generic ident_stream error-sending func */
|
||||
syslog(LOG_ERR, "asprintf: %m");
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
write(s, p, strlen(p));
|
||||
send(s, p, strlen(p), MSG_EOF);
|
||||
free(p);
|
||||
|
||||
exit(0);
|
||||
@ -614,7 +614,7 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */
|
||||
syslog(LOG_ERR, "asprintf: %m");
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
write(s, p, strlen(p));
|
||||
send(s, p, strlen(p), MSG_EOF);
|
||||
free(p);
|
||||
|
||||
exit(0);
|
||||
@ -676,7 +676,7 @@ machtime_stream(s, sep)
|
||||
unsigned long result;
|
||||
|
||||
result = machtime();
|
||||
(void) write(s, (char *) &result, sizeof(result));
|
||||
(void) send(s, (char *) &result, sizeof(result), MSG_EOF);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user