server no longer asserts when a client connects with a name that's

already in use by another client.  also added reporting of errors
from the server to clients so clients can report meaningful
messages to users.
This commit is contained in:
crs
2002-05-23 14:56:03 +00:00
parent 995771eec1
commit 13eee14232
8 changed files with 159 additions and 57 deletions

View File

@@ -50,18 +50,19 @@ IServerProtocol* CServerProtocol::create(SInt32 major, SInt32 minor,
CServer* server, const CString& client,
IInputStream* input, IOutputStream* output)
{
// disallow invalid version numbers
if (major < 0 || minor < 0) {
throw XIncompatibleClient(major, minor);
}
// disallow connection from test versions to release versions
if (major == 0 && kMajorVersion != 0) {
output->write(kMsgEIncompatible, sizeof(kMsgEIncompatible) - 1);
output->flush();
throw XIncompatibleClient(major, minor);
}
// hangup (with error) if version isn't supported
if (major > kMajorVersion ||
(major == kMajorVersion && minor > kMinorVersion)) {
output->write(kMsgEIncompatible, sizeof(kMsgEIncompatible) - 1);
output->flush();
throw XIncompatibleClient(major, minor);
}