Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
red5-server-GL
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Amine Chbari
red5-server-GL
Commits
30068839
Commit
30068839
authored
1 year ago
by
amine.chbari.etu
Browse files
Options
Downloads
Patches
Plain Diff
refactoriser la methode connect() , organisation de la classe 'CoreHandler.java'
parent
7916b5bd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/src/main/java/org/red5/server/CoreHandler.java
+47
-24
47 additions, 24 deletions
server/src/main/java/org/red5/server/CoreHandler.java
with
47 additions
and
24 deletions
server/src/main/java/org/red5/server/CoreHandler.java
+
47
−
24
View file @
30068839
...
...
@@ -47,6 +47,49 @@ public class CoreHandler implements IScopeHandler, CoreHandlerMXBean {
return
connect
(
conn
,
scope
,
null
);
}
/** Auxiliary function to connect
*
* Creates a client if needed then sets the client on the connection
*
* @param client
* the connected client
* @param clientRegistry
* the client's registry
* @param conn
* Client connection
* @param params
* Parameters passed from client side with connect call
* @return the connection with an updated client
*/
private
IConnection
connectionHandleClient
(
IClient
client
,
IClientRegistry
clientRegistry
,
IConnection
conn
,
Object
[]
params
)
{
if
(
client
==
null
)
{
if
(!
clientRegistry
.
hasClient
(
conn
.
getSessionId
()))
{
if
(
conn
instanceof
RTMPTConnection
)
{
log
.
debug
(
"Creating new client for RTMPT connection"
);
// create a new client using the session id as the client's id
client
=
new
Client
(
conn
.
getSessionId
(),
(
ClientRegistry
)
clientRegistry
);
clientRegistry
.
addClient
(
client
);
// set the client on the connection
conn
.
setClient
(
client
);
}
else
if
(
conn
instanceof
RTMPConnection
)
{
log
.
debug
(
"Creating new client for RTMP connection"
);
// this is a new connection, create a new client to hold it
client
=
clientRegistry
.
newClient
(
params
);
// set the client on the connection
conn
.
setClient
(
client
);
}
}
else
{
client
=
clientRegistry
.
lookupClient
(
conn
.
getSessionId
());
conn
.
setClient
(
client
);
}
}
else
{
// set the client on the connection
conn
.
setClient
(
client
);
}
return
conn
;
}
/**
* Connects client to the scope
*
...
...
@@ -80,30 +123,10 @@ public class CoreHandler implements IScopeHandler, CoreHandlerMXBean {
log
.
debug
(
"Client registry: {}"
,
(
clientRegistry
==
null
?
"is null"
:
"not null"
));
if
(
clientRegistry
!=
null
)
{
IClient
client
=
conn
.
getClient
();
if
(
client
==
null
)
{
if
(!
clientRegistry
.
hasClient
(
id
))
{
if
(
conn
instanceof
RTMPTConnection
)
{
log
.
debug
(
"Creating new client for RTMPT connection"
);
// create a new client using the session id as the client's id
client
=
new
Client
(
id
,
(
ClientRegistry
)
clientRegistry
);
clientRegistry
.
addClient
(
client
);
// set the client on the connection
conn
.
setClient
(
client
);
}
else
if
(
conn
instanceof
RTMPConnection
)
{
log
.
debug
(
"Creating new client for RTMP connection"
);
// this is a new connection, create a new client to hold it
client
=
clientRegistry
.
newClient
(
params
);
// set the client on the connection
conn
.
setClient
(
client
);
}
}
else
{
client
=
clientRegistry
.
lookupClient
(
id
);
conn
.
setClient
(
client
);
}
}
else
{
// set the client on the connection
conn
.
setClient
(
client
);
}
// call connectionHandleClient to handle all the cases for this connection
conn
=
connectionHandleClient
(
client
,
clientRegistry
,
conn
,
params
);
// assign connection to client
conn
.
initialize
(
client
);
// we could checked for banned clients here
...
...
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