ClientWrite: merge client_write() into Client::Write()
This commit is contained in:
parent
77b34fa961
commit
6cce3d2996
@ -112,7 +112,7 @@ public:
|
|||||||
void Close();
|
void Close();
|
||||||
void SetExpired();
|
void SetExpired();
|
||||||
|
|
||||||
using FullyBufferedSocket::Write;
|
bool Write(const void *data, size_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the uid of the client process, or a negative value
|
* returns the uid of the client process, or a negative value
|
||||||
|
@ -23,30 +23,24 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/**
|
bool
|
||||||
* Write a block of data to the client.
|
Client::Write(const void *data, size_t length)
|
||||||
*/
|
|
||||||
static void
|
|
||||||
client_write(Client &client, const char *data, size_t length)
|
|
||||||
{
|
{
|
||||||
/* if the client is going to be closed, do nothing */
|
/* if the client is going to be closed, do nothing */
|
||||||
if (client.IsExpired() || length == 0)
|
return !IsExpired() && FullyBufferedSocket::Write(data, length);
|
||||||
return;
|
|
||||||
|
|
||||||
client.Write(data, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
client_puts(Client &client, const char *s)
|
client_puts(Client &client, const char *s)
|
||||||
{
|
{
|
||||||
client_write(client, s, strlen(s));
|
client.Write(s, strlen(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
client_vprintf(Client &client, const char *fmt, va_list args)
|
client_vprintf(Client &client, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
char *p = FormatNewV(fmt, args);
|
char *p = FormatNewV(fmt, args);
|
||||||
client_write(client, p, strlen(p));
|
client.Write(p, strlen(p));
|
||||||
delete[] p;
|
delete[] p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user