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
2008-11-08 21:54:17 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c3974a440e643fcf276f8c81969c852e77d543d7
c3974a44
1 parent
18e78cc7
Add lock around progress updates and cancel to iphone attempting to access zombie data
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
ASIHTTPRequest.h
ASIHTTPRequest.m
iphone-xibs/Synchronous.xib
ASIHTTPRequest.h
View file @
c3974a4
...
...
@@ -112,6 +112,9 @@
//This lock will block the request until the delegate supplies authentication info
NSConditionLock
*
authenticationLock
;
//This lock prevents the operation from being cancelled while it is trying to update the progress, and vice versa
NSLock
*
progressLock
;
//Called on the delegate when the request completes successfully
SEL
didFinishSelector
;
...
...
ASIHTTPRequest.m
View file @
c3974a4
...
...
@@ -85,6 +85,7 @@ static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventTy
[
domain
release
];
[
authenticationRealm
release
];
[
url
release
];
[
progressLock
release
];
[
authenticationLock
release
];
[
lastActivityTime
release
];
[
responseCookies
release
];
...
...
@@ -118,6 +119,13 @@ static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventTy
return
complete
;
}
-
(
void
)
cancel
{
[
progressLock
lock
];
[
super
cancel
];
[
progressLock
unlock
];
}
-
(
int
)
totalBytesRead
{
return
totalBytesRead
;
...
...
@@ -207,6 +215,9 @@ static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventTy
{
CFRunLoopAddCommonMode
(
CFRunLoopGetCurrent
(),
ASIHTTPRequestRunMode
);
[
progressLock
release
];
progressLock
=
[[
NSLock
alloc
]
init
];
[
authenticationLock
release
];
authenticationLock
=
[[
NSConditionLock
alloc
]
initWithCondition
:
1
];
...
...
@@ -321,8 +332,14 @@ static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventTy
-
(
void
)
updateProgressIndicators
{
[
progressLock
lock
];
if
([
self
isCancelled
])
{
[
progressLock
unlock
];
return
;
}
[
self
updateUploadProgress
];
[
self
updateDownloadProgress
];
[
progressLock
unlock
];
}
...
...
iphone-xibs/Synchronous.xib
View file @
c3974a4
...
...
@@ -30,15 +30,17 @@
<object
class=
"IBUILabel"
id=
"602749642"
>
<reference
key=
"NSNextResponder"
ref=
"191373211"
/>
<int
key=
"NSvFlags"
>
292
</int>
<string
key=
"NSFrame"
>
{{20, 20}, {280, 1
05
}}
</string>
<string
key=
"NSFrame"
>
{{20, 20}, {280, 1
44
}}
</string>
<reference
key=
"NSSuperview"
ref=
"191373211"
/>
<bool
key=
"IBUIOpaque"
>
NO
</bool>
<bool
key=
"IBUIClipsSubviews"
>
YES
</bool>
<bool
key=
"IBUIUserInteractionEnabled"
>
NO
</bool>
<string
type=
"base64-UTF8"
key=
"IBUIText"
>
RGVtb25zdHJhdGVzIGZldGNoaW5nIGEgd2ViIHBhZ2Ugc3luY2hyb25vdXNseSwgdGhlIEhUTUwgc291
cmNlIHdpbGwgYXBwZWFyIGluIHRoZSBib3ggYmVsb3cgd2hlbiB0aGUgZG93bmxvYWQgaXMgY29tcGxl
dGUuICBJbiByZWFsIHdvcmxkIHNpdHVhdGlvbnMsIHlvdSdkIGJlIG1vcmUgbGlrZWx5IHRvIHJ1biB0
aGlzIGluIGEgdGhyZWFkLg
</string>
dGUuICBUaGUgaW50ZXJmYWNlIHdpbGwgbG9jayB1cCB3aGVuIHlvdSBwcmVzcyB0aGlzIGJ1dHRvbiB1
bnRpbCB0aGUgb3BlcmF0aW9uIHRpbWVzIG91dCBvciBzdWNjZWVkcy4gSW4gcmVhbCB3b3JsZCBzaXR1
YXRpb25zLCB5b3UnZCBiZSBtb3JlIGxpa2VseSB0byB1c2Ugc3luY2hyb25vdXMgcmVxdWVzdHMgaW4g
YSB0aHJlYWQuA
</string>
<object
class=
"NSFont"
key=
"IBUIFont"
id=
"467718481"
>
<string
key=
"NSName"
>
Helvetica
</string>
<double
key=
"NSSize"
>
1.400000e+01
</double>
...
...
@@ -56,7 +58,7 @@ aGlzIGluIGEgdGhyZWFkLg</string>
<object
class=
"IBUIButton"
id=
"963091686"
>
<reference
key=
"NSNextResponder"
ref=
"191373211"
/>
<int
key=
"NSvFlags"
>
292
</int>
<string
key=
"NSFrame"
>
{{20, 1
33
}, {72, 37}}
</string>
<string
key=
"NSFrame"
>
{{20, 1
72
}, {72, 37}}
</string>
<reference
key=
"NSSuperview"
ref=
"191373211"
/>
<bool
key=
"IBUIOpaque"
>
NO
</bool>
<bool
key=
"IBUIClearsContextBeforeDrawing"
>
NO
</bool>
...
...
@@ -84,7 +86,7 @@ aGlzIGluIGEgdGhyZWFkLg</string>
<object
class=
"IBUITextView"
id=
"251778509"
>
<reference
key=
"NSNextResponder"
ref=
"191373211"
/>
<int
key=
"NSvFlags"
>
292
</int>
<string
key=
"NSFrame"
>
{{20,
184}, {280, 187
}}
</string>
<string
key=
"NSFrame"
>
{{20,
217}, {280, 154
}}
</string>
<reference
key=
"NSSuperview"
ref=
"191373211"
/>
<bool
key=
"IBUIOpaque"
>
NO
</bool>
<bool
key=
"IBUIClipsSubviews"
>
YES
</bool>
...
...
Please
register
or
login
to post a comment