mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-10 00:11:43 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user