Skip to content

Commit

Permalink
Merge branch 'gerardg/master'
Browse files Browse the repository at this point in the history
Also remove xcodeproj user files.

Conflicts:
	AsyncSocket.m
	EchoServer.m
	English.lproj/MainMenu.xib
	ValueInfo.m
	data_AppDelegate.m
	mcinsight.xcodeproj/gerard.mode1v3
	mcinsight.xcodeproj/gerard.pbxuser
	mcinsight.xcodeproj/project.pbxproj
  • Loading branch information
kommen committed Apr 23, 2010
2 parents 103f1b4 + 3f1190c commit 2faef9e
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 1,977 deletions.
1 change: 0 additions & 1 deletion AsyncSocket.m
Expand Up @@ -509,7 +509,6 @@ - (CFSocketRef) createAcceptSocketForAddress:(NSData *)addr error:(NSError **)er

if (socket == NULL && errPtr)
*errPtr = [self getSocketError];

return socket;
}

Expand Down
11 changes: 9 additions & 2 deletions EchoServer.m
Expand Up @@ -84,7 +84,7 @@ -(void)sendOut:(AsyncSocket *)sock string:(NSString *)string tag:(long)tag {
info.sid = tag;
info.direction = YES;
[loggy addObject:info];

[info release];
[sock writeData:[[string stringByAppendingString:@"\r\n"] dataUsingEncoding:NSASCIIStringEncoding] withTimeout:-1 tag:tag];
}

Expand All @@ -108,6 +108,8 @@ -(void) onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag

ValueInfo *temp = [self getVI:sock.mc_vi.key];

[info release];

if ([sock.mc_vi.command isEqualToString:@"add"]) {
if (temp == nil) {
[dict setObject:sock.mc_vi forKey:sock.mc_vi.key];
Expand Down Expand Up @@ -149,6 +151,7 @@ -(void) onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag
NSString *str = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSString *str2 = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

[str release];
LogInfo *info = [LogInfo alloc];
info.data = str2;
info.sid = tag;
Expand All @@ -159,6 +162,8 @@ -(void) onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag
NSString *command = [listItems objectAtIndex:0];
NSString *key = [listItems objectAtIndex:1];

[info release];

if ([command isEqualToString:@"set"] || [command isEqualToString:@"add"] || [command isEqualToString:@"replace"] ||
[command isEqualToString:@"append"] || [command isEqualToString:@"prepend"] || [command isEqualToString:@"cas"]) {
sock.mc_vi = [[ValueInfo alloc] init];
Expand Down Expand Up @@ -187,7 +192,7 @@ -(void) onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag
info.sid = tag;
info.direction = YES;
[loggy addObject:info];

[info release];
[sock writeData:temp.data withTimeout:-1 tag:tag];
[sock writeData:[@"\r\n" dataUsingEncoding:NSASCIIStringEncoding] withTimeout:-1 tag:tag];
} else {
Expand All @@ -205,6 +210,7 @@ -(void) onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag
if (temp) {
NSString *sval = [[NSString alloc] initWithData:temp.data encoding:NSASCIIStringEncoding];
unsigned long long val = [sval longLongValue] + 1;
[sval release];
temp.data = [NSMutableData dataWithData:[[NSString stringWithFormat:@"%d", val] dataUsingEncoding:NSASCIIStringEncoding]];
[dict setObject:temp forKey:key];
[self sendOut:sock string:[NSString stringWithFormat:@"%d", val] tag:tag];
Expand All @@ -215,6 +221,7 @@ -(void) onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag
if (temp) {
NSString *sval = [[NSString alloc] initWithData:temp.data encoding:NSASCIIStringEncoding];
unsigned long long val = [sval longLongValue] - 1;
[sval release];
if (val < 0)
val = 0;
temp.data = [NSMutableData dataWithData:[[NSString stringWithFormat:@"%d", val] dataUsingEncoding:NSASCIIStringEncoding]];
Expand Down
6 changes: 3 additions & 3 deletions English.lproj/MainMenu.xib
Expand Up @@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="372"/>
<integer value="584"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -1753,7 +1753,7 @@
</object>
<object class="NSButton" id="228810398">
<reference key="NSNextResponder" ref="337360871"/>
<int key="NSvFlags">268</int>
<int key="NSvFlags">296</int>
<string key="NSFrame">{{511, 2}, {96, 32}}</string>
<reference key="NSSuperview" ref="337360871"/>
<bool key="NSEnabled">YES</bool>
Expand All @@ -1773,7 +1773,7 @@
</object>
<object class="NSButton" id="283435414">
<reference key="NSNextResponder" ref="337360871"/>
<int key="NSvFlags">268</int>
<int key="NSvFlags">296</int>
<string key="NSFrame">{{607, 2}, {130, 32}}</string>
<reference key="NSSuperview" ref="337360871"/>
<bool key="NSEnabled">YES</bool>
Expand Down
1 change: 1 addition & 0 deletions Runner.m
Expand Up @@ -19,6 +19,7 @@ - (void)run {
[es performSelector:@selector(acceptOnPortString:) withObject:portString afterDelay:1.0];
[[NSRunLoop currentRunLoop] run];
[EchoServer release];
[es release];
[pool release];
}

Expand Down
7 changes: 5 additions & 2 deletions ValueInfo.m
Expand Up @@ -19,8 +19,11 @@ @implementation ValueInfo
@synthesize flag;
@synthesize command;

-(void) init {
hits=0;
-(id) init {
if (self = [super init]) {
hits=0;
}
return self;
}

@end
5 changes: 3 additions & 2 deletions data_AppDelegate.m
@@ -1,4 +1,3 @@

#import "data_AppDelegate.h";
#import "EchoServer.h";
#import "ValueInfo.h";
Expand Down Expand Up @@ -38,7 +37,7 @@ - (void)run {
selector:@selector(localizedCaseInsensitiveCompare:)] autorelease];

NSArray *initDescriptors = [NSArray arrayWithObjects:keyDescriptor, nil];
memcacheSnapshot.entries = [memcacheSnapshot.entries sortedArrayUsingDescriptors:initDescriptors];
[memcacheSnapshot.entries sortUsingDescriptors:initDescriptors];
}

[memcacheSnapshot filterBy:searchFilter];
Expand All @@ -51,6 +50,7 @@ - (void)run {
[cacheMissesTextField setIntValue:[memcacheSnapshot cacheMisses]];
[hitRatioTextField setStringValue:[memcacheSnapshot hitRatio]];
sleep(1);
[memcacheSnapshot release];
[autoreleasepool release];
}
}
Expand Down Expand Up @@ -141,6 +141,7 @@ - (IBAction) search: (id) sender {

- (void) dealloc {
[table release];
[memcacheSnapshot release];
[super dealloc];
}

Expand Down
10 changes: 6 additions & 4 deletions main.m
Expand Up @@ -12,8 +12,10 @@

int main(int argc, char *argv[])
{
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
[NSThread detachNewThreadSelector:@selector(run) toTarget:[Runner alloc] withObject:nil];
[autoreleasepool release];
return NSApplicationMain(argc, (const char **) argv);
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
Runner *runner = [Runner alloc];
[NSThread detachNewThreadSelector:@selector(run) toTarget:runner withObject:nil];
[runner release];
[autoreleasepool release];
return NSApplicationMain(argc, (const char **) argv);
}

0 comments on commit 2faef9e

Please sign in to comment.