Add some support for serilizer and DO formats so, from the next but one release

onwards, we will be able to do better versioning with newer versions always
being able to interoperate with code later than 1.6.0 since the post 1.6.0
code will be able to say what version it can handle.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/freeze-1_6_0@16098 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-03-01 10:15:10 +00:00
parent b4624cc0ab
commit 72819efe08
2 changed files with 18 additions and 0 deletions

View file

@ -2,6 +2,11 @@
* Source/NSSerializer.m: Fix crash when deserializing a corrupt or
truncated archive ... raise exception rather than segfaulting.
Added code to recognize newer versions of the serialiser format and
give up if they are encountered and cannot be handled.
* Source/GSTcpPort.m: Added code to recognise newer versions of the
port format and give up if they are encountered and cannot be handled.
This allows for the addition of decent versioning in later formats.
2003-02-28 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -288,6 +288,12 @@ decodePort(NSData *data, NSString *defaultAddress)
length = GSSwapBigI32ToHost(pih->length);
pi = (GSPortInfo*)&pih[1];
pnum = GSSwapBigI16ToHost(pi->num);
if (strncmp(pi->addr, "VER", 3) == 0)
{
NSLog(@"Remote version of GNUstep at %s:%d is more recent than this one",
pi->addr, pnum);
return nil;
}
addr = [NSString stringWithCString: pi->addr];
NSDebugFLLog(@"NSPort", @"Decoded port as '%@:%d'", addr, pnum);
@ -1028,6 +1034,13 @@ static Class runLoopClass;
rType = GSP_NONE; /* ready for a new item */
p = decodePort(rData, defaultAddress);
if (p == nil)
{
NSLog(@"%@ - unable to decode remote port", self);
DO_UNLOCK(myLock);
[self invalidate];
return;
}
/*
* Set up to read another item header.
*/