Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mullvad Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Mullvad Browser
Commits
0215be72
Commit
0215be72
authored
24 years ago
by
darin%netscape.com
Browse files
Options
Downloads
Patches
Plain Diff
Fixes bug 66494. Assertion in nsAutoLock. r/sr=brendan@mozilla.org.
parent
673e0333
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
netwerk/base/src/nsStreamListenerProxy.cpp
+22
-14
22 additions, 14 deletions
netwerk/base/src/nsStreamListenerProxy.cpp
netwerk/base/src/nsStreamListenerProxy.h
+1
-0
1 addition, 0 deletions
netwerk/base/src/nsStreamListenerProxy.h
with
23 additions
and
14 deletions
netwerk/base/src/nsStreamListenerProxy.cpp
+
22
−
14
View file @
0215be72
...
...
@@ -59,6 +59,7 @@
nsStreamListenerProxy
::
nsStreamListenerProxy
()
:
mLock
(
nsnull
)
,
mPendingCount
(
0
)
,
mPipeEmptied
(
PR_FALSE
)
,
mListenerStatus
(
NS_OK
)
{
}
...
...
@@ -258,19 +259,15 @@ nsStreamListenerProxy::OnDataAvailable(nsIChannel *aChannel,
}
}
//
// Enter the ChannelToResume lock
//
{
nsAutoLock
lock
(
mLock
);
while
(
1
)
{
mPipeEmptied
=
PR_FALSE
;
//
// Try to copy data into the pipe.
//
// If the pipe is full, then
suspend the calling channel. It
//
will be resumed when the pipe is emptied. Being inside the
//
C
ha
nnelToResume lock ensures that the resume will follow
//
the suspend
.
// If the pipe is full, then
we return NS_BASE_STREAM_WOULD_BLOCK
//
so the calling channel can suspend itself. If, however, we detect
//
t
ha
t the pipe was emptied during this time, we retry copying data
//
into the pipe
.
//
rv
=
mPipeOut
->
WriteFrom
(
aSource
,
aCount
,
&
bytesWritten
);
...
...
@@ -279,15 +276,23 @@ nsStreamListenerProxy::OnDataAvailable(nsIChannel *aChannel,
if
(
NS_FAILED
(
rv
))
{
if
(
rv
==
NS_BASE_STREAM_WOULD_BLOCK
)
{
LOG
((
"nsStreamListenerProxy: Setting channel to resume [chan=%x]
\n
"
,
aChannel
));
nsAutoLock
lock
(
mLock
);
if
(
mPipeEmptied
)
{
LOG
((
"nsStreamListenerProxy: Pipe emptied; looping back [chan=%x]
\n
"
,
aChannel
));
continue
;
}
LOG
((
"nsStreamListenerProxy: Pipe full; setting channel to resume [chan=%x]
\n
"
,
aChannel
));
mChannelToResume
=
aChannel
;
}
return
rv
;
}
else
if
(
bytesWritten
==
0
)
{
if
(
bytesWritten
==
0
)
{
LOG
((
"nsStreamListenerProxy: Copied zero bytes; not posting an event [chan=%x]
\n
"
,
aChannel
));
return
NS_OK
;
}
// Copied something into the pipe...
break
;
}
//
...
...
@@ -377,8 +382,11 @@ nsStreamListenerProxy::OnEmpty(nsIInputStream *aInputStream)
nsCOMPtr
<
nsIChannel
>
chan
;
{
nsAutoLock
lock
(
mLock
);
chan
=
mChannelToResume
;
mChannelToResume
=
0
;
if
(
mChannelToResume
)
{
chan
=
mChannelToResume
;
mChannelToResume
=
0
;
}
mPipeEmptied
=
PR_TRUE
;
// Flag this call
}
if
(
chan
)
{
LOG
((
"nsStreamListenerProxy: Resuming channel
\n
"
));
...
...
This diff is collapsed.
Click to expand it.
netwerk/base/src/nsStreamListenerProxy.h
+
1
−
0
View file @
0215be72
...
...
@@ -45,6 +45,7 @@ protected:
nsCOMPtr
<
nsIChannel
>
mChannelToResume
;
PRLock
*
mLock
;
PRUint32
mPendingCount
;
PRBool
mPipeEmptied
;
nsresult
mListenerStatus
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment