Skip to content
Browse files

Some listener fixes

Make release build work, fix some static analyzer warnings, etc.
  • Loading branch information...
1 parent 40e53ac commit 21bf1dadb1619d1e2e9e16d96f5e8b56a8061379 @snej snej committed Jan 2, 2012
View
7 Demo-Mac/DemoAppController.m
@@ -31,6 +31,9 @@ int main (int argc, const char * argv[]) {
}
+static TDListener* sListener;
+
+
@implementation DemoAppController
@@ -98,10 +101,12 @@ - (void) applicationDidFinishLaunching: (NSNotification*)n {
object: nil];
// Start a listener socket:
- [[[TDListener alloc] initWithTDServer: server.touchServer port: 8888] start];
+ sListener = [[TDListener alloc] initWithTDServer: server.touchServer port: 8888];
+ [sListener start];
}
+
#pragma mark - SYNC:
View
4 Listener/TDHTTPConnection.h
@@ -11,9 +11,5 @@
@interface TDHTTPConnection : HTTPConnection
-{
- @private
- TDRouter* _router;
-}
@end
View
5 Listener/TDHTTPConnection.m
@@ -54,9 +54,10 @@ - (BOOL)supportsMethod:(NSString *)method atPath:(NSString *)path
[((TDHTTPServer*)config.server).listener onServerThread: ^{[router start];}];
NSAssert(finished, @"Router didn't finish");
- BOOL pretty = [router boolQuery: @"pretty"];
#if DEBUG
- pretty = YES;
+ BOOL pretty = YES;
+#else
+ BOOL pretty = [router boolQuery: @"pretty"];
#endif
TDHTTPResponse* response = [[[TDHTTPResponse alloc] initWithTDResponse: routerResponse
pretty: pretty] autorelease];
View
12 Listener/TDHTTPResponse.m
@@ -15,7 +15,17 @@ @implementation TDHTTPResponse
- (id) initWithTDResponse: (TDResponse*)response pretty: (BOOL)pretty {
- self = [super initWithData: (pretty ? response.body.asPrettyJSON : response.body.asJSON)];
+ NSData* responseBody = (pretty ? response.body.asPrettyJSON : response.body.asJSON);
+ int status = response.status;
+ if (!responseBody && status >= 300) {
+ // Put a generic error message in the body:
+ responseBody = [[NSString stringWithFormat: @"%d %@\n",
+ status, [NSHTTPURLResponse localizedStringForStatusCode: status]]
+ dataUsingEncoding: NSUTF8StringEncoding];
+ [response.headers setObject: @"text/plain; encoding=UTF-8" forKey: @"Content-Type"];
+ }
+
+ self = [super initWithData: responseBody];
if (self) {
_response = [response retain];
}
View
2 Source/TDRouter.m
@@ -23,7 +23,7 @@
#import <objc/message.h>
-NSString* const kTDVersionString = @"0.1";
+NSString* const kTDVersionString = @"0.2";
@interface TDRouter ()
View
7 Source/TouchDB.exp
@@ -1,16 +1,17 @@
# Symbols exported by the framework
.objc_class_name_TDDatabase
.objc_class_name_TDView
-.objc_class_name_TDContentStore
+.objc_class_name_TDBlobStore
.objc_class_name_TDBody
-.objc_class_name_TDRev
-.objc_class_name_TDRevList
+.objc_class_name_TDRevision
+.objc_class_name_TDRevisionList
.objc_class_name_TDReplicator
.objc_class_name_TDPusher
.objc_class_name_TDPuller
.objc_class_name_TDURLProtocol
+.objc_class_name_TDRouter
.objc_class_name_TDServer
_TDDatabaseChangeNotification
View
4 TouchDB.xcodeproj/project.pbxproj
@@ -1896,17 +1896,21 @@
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXPORTED_SYMBOLS_FILE = Listener/TouchDBListener.exp;
FRAMEWORK_VERSION = A;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_SIGN_COMPARE = NO;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
INFOPLIST_FILE = "Listener/TouchDBListener-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
+ STRIP_INSTALLED_PRODUCT = YES;
WRAPPER_EXTENSION = framework;
};
name = Release;

0 comments on commit 21bf1da

Please sign in to comment.
Something went wrong with that request. Please try again.