Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2009-11-25 17:07:16 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d156fef322d5d95cc43ab01891b9a186cdbcff26
d156fef3
1 parent
7a5f49ed
Fix stress test
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
12 deletions
Classes/ASIHTTPRequest.h
Classes/ASIHTTPRequest.m
Classes/Tests/StressTests.h
Classes/Tests/StressTests.m
Classes/ASIHTTPRequest.h
View file @
d156fef
...
...
@@ -365,6 +365,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Run a request asynchronously in the current thread
-
(
void
)
startAsynchronous
;
-
(
void
)
startInBackgroundThread
;
#pragma mark request logic
...
...
Classes/ASIHTTPRequest.m
View file @
d156fef
...
...
@@ -444,6 +444,12 @@ static BOOL isiPhoneOS2;
[
self
setInProgress
:
NO
];
}
-
(
void
)
startInBackgroundThread
{
runningInOwnThread
=
YES
;
[
self
performSelectorInBackground
:
@selector
(
startAsynchronous
)
withObject
:
nil
];
}
-
(
void
)
start
{
...
...
@@ -1741,8 +1747,7 @@ static BOOL isiPhoneOS2;
{
// Mac authentication dialog coming soon!
#if TARGET_OS_IPHONE
// Cannot show the dialog when we are running on the main thread, as the locks will cause the app to hang
if
([
self
shouldPresentProxyAuthenticationDialog
]
&&
!
[
NSThread
isMainThread
])
{
if
([
self
shouldPresentProxyAuthenticationDialog
])
{
[
ASIAuthenticationDialog
performSelectorOnMainThread
:
@selector
(
presentProxyAuthenticationDialogForRequest
:)
withObject
:
self
waitUntilDone
:
[
NSThread
isMainThread
]];
return
YES
;
}
...
...
@@ -1755,11 +1760,7 @@ static BOOL isiPhoneOS2;
-
(
BOOL
)
askDelegateForProxyCredentials
{
// Can't use delegate authentication when running on the main thread
if
([
NSThread
isMainThread
])
{
return
NO
;
}
// If we have a delegate, we'll see if it can handle proxyAuthenticationNeededForRequest:.
// Otherwise, we'll try the queue (if this request is part of one) and it will pass the message on to its own delegate
id
authenticationDelegate
=
[
self
delegate
];
...
...
@@ -1933,7 +1934,6 @@ static BOOL isiPhoneOS2;
{
// Mac authentication dialog coming soon!
#if TARGET_OS_IPHONE
// Cannot show the dialog when we are running on the main thread, as the locks will cause the app to hang
if
([
self
shouldPresentAuthenticationDialog
])
{
[
ASIAuthenticationDialog
performSelectorOnMainThread
:
@selector
(
presentAuthenticationDialogForRequest
:)
withObject
:
self
waitUntilDone
:
[
NSThread
isMainThread
]];
return
YES
;
...
...
Classes/Tests/StressTests.h
View file @
d156fef
...
...
@@ -35,6 +35,8 @@
-
(
void
)
testSetDelegate
;
-
(
void
)
performSetDelegateRequest
;
-
(
void
)
setProgress
:(
float
)
newProgress
;
@property
(
retain
)
ASIHTTPRequest
*
cancelRequest
;
@property
(
retain
)
NSDate
*
cancelStartDate
;
@property
(
retain
)
MyDelegate
*
delegate
;
...
...
Classes/Tests/StressTests.m
View file @
d156fef
...
...
@@ -52,7 +52,7 @@ IMPORTANT
[[
self
cancelRequest
]
setDownloadProgressDelegate
:
self
];
[[
self
cancelRequest
]
setShowAccurateProgress
:
YES
];
NSLog
(
@"Stress test: Start request %@"
,[
self
cancelRequest
]);
[[
self
cancelRequest
]
start
];
[[
self
cancelRequest
]
start
InBackgroundThread
];
}
}
...
...
@@ -76,7 +76,7 @@ IMPORTANT
[
self
setCancelRequest
:[
ASIHTTPRequest
requestWithURL
:[
NSURL
URLWithString
:
@"http://127.0.0.1/ASIHTTPRequest/tests/one_infinite_loop"
]]];
if
([[
self
cancelStartDate
]
timeIntervalSinceNow
]
>
0
)
{
NSLog
(
@"Redirect stress test: Start request %@"
,[
self
cancelRequest
]);
[[
self
cancelRequest
]
start
];
[[
self
cancelRequest
]
start
InBackgroundThread
];
[
self
performSelector
:
@selector
(
cancelRedirectRequest
)
withObject
:
nil
afterDelay
:
0
.
2
];
}
[
createRequestLock
unlock
];
...
...
@@ -113,7 +113,7 @@ IMPORTANT
[[
self
cancelRequest
]
setDelegate
:
delegate
];
[[
self
cancelRequest
]
setShowAccurateProgress
:
YES
];
NSLog
(
@"Set delegate stress test: Start request %@"
,[
self
cancelRequest
]);
[[
self
cancelRequest
]
start
];
[[
self
cancelRequest
]
start
InBackgroundThread
];
[
self
performSelectorInBackground
:
@selector
(
cancelSetDelegateRequest
)
withObject
:
nil
];
}
[
createRequestLock
unlock
];
...
...
@@ -127,7 +127,12 @@ IMPORTANT
}
-
(
void
)
setProgress
:
(
float
)
newProgress
;
-
(
void
)
setDoubleValue
:
(
double
)
newProgress
{
[
self
setProgress
:(
float
)
newProgress
];
}
-
(
void
)
setProgress
:
(
float
)
newProgress
{
progress
=
newProgress
;
...
...
Please
register
or
login
to post a comment