diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-11-10 18:02:05 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-11-10 18:02:05 -0800 |
commit | 2b8da85d9f6270edd5a83b35d5116de216ace06e (patch) | |
tree | d1f6162a163e4c57ef5dc42b43deadf3d85dee9f /sockutils.h | |
parent | 448a60e4082d9d31caa19ec1dffec61f062b148f (diff) |
Handle the client closing the connection better.
On the server side, don't treat an immediate EOF when trying to read a
message header as an error, just silently terminate the session. Treat
EOFs after reading *some* of the message as an error.
Diffstat (limited to 'sockutils.h')
-rw-r--r-- | sockutils.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sockutils.h b/sockutils.h index 87f9c65d..20127f03 100644 --- a/sockutils.h +++ b/sockutils.h @@ -168,10 +168,14 @@ int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD, /* 'server' flag; it opens a server socket */ #define SOCKOPEN_SERVER 1 -/* Changes the behaviour of the sock_recv(); it does not wait to receive all data */ -#define SOCK_RECEIVEALL_NO 0 -/* Changes the behaviour of the sock_recv(); it waits to receive all data */ -#define SOCK_RECEIVEALL_YES 1 +/* + * Flags for sock_recv(). + */ +#define SOCK_RECEIVEALL_NO 0x00000000 /* Don't wait to receive all data */ +#define SOCK_RECEIVEALL_YES 0x00000001 /* Wait to receive all data */ + +#define SOCK_EOF_ISNT_ERROR 0x00000000 /* Return 0 on EOF */ +#define SOCK_EOF_IS_ERROR 0x00000002 /* Return an error on EOF */ /* * \} |