Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
Tenjin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
Tenjin
Commits
ade22534
Commit
ade22534
authored
May 14, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #2 handle error instead of unwrap
parent
98f795c2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
tcp_listener.rs
src/openflow/tcp_listener.rs
+10
-9
No files found.
src/openflow/tcp_listener.rs
View file @
ade22534
...
@@ -14,20 +14,21 @@ pub fn tcp_listener_handler<OME: OfpMsgEvent>(address: &str, ofp_version: u8) {
...
@@ -14,20 +14,21 @@ pub fn tcp_listener_handler<OME: OfpMsgEvent>(address: &str, ofp_version: u8) {
Ok
(
mut
stream
)
=>
{
Ok
(
mut
stream
)
=>
{
let
controller_clone
=
controller
.clone
();
let
controller_clone
=
controller
.clone
();
thread
::
spawn
(
move
||
{
thread
::
spawn
(
move
||
{
controller_clone
let
mut
ctrl
=
match
controller_clone
.lock
()
{
.lock
()
Ok
(
guard
)
=>
guard
,
.unwrap
()
Err
(
poinsoned
)
=>
{
.send_msg
(
HelloEvent
::
new
(),
0
,
&
mut
stream
);
let
guard
=
poinsoned
.into_inner
();
let
ofp_size
=
controller_clone
.lock
()
.unwrap
()
.get_ofp
()
.header_size
();
guard
}
};
ctrl
.send_msg
(
HelloEvent
::
new
(),
0
,
&
mut
stream
);
let
ofp_size
=
ctrl
.get_ofp
()
.header_size
();
// let ofp = controller.lock().unwrap().get_ofp();
// let ofp = controller.lock().unwrap().get_ofp();
let
mut
buffer
=
vec!
[
0u8
;
ofp_size
];
let
mut
buffer
=
vec!
[
0u8
;
ofp_size
];
loop
{
loop
{
match
stream
.read
(
&
mut
buffer
)
{
match
stream
.read
(
&
mut
buffer
)
{
Ok
(
v
)
if
v
>
0
=>
{
Ok
(
v
)
if
v
>
0
=>
{
controller_clone
ctrl
.request_handler
(
&
mut
buffer
,
&
mut
stream
);
.lock
()
.unwrap
()
.request_handler
(
&
mut
buffer
,
&
mut
stream
);
}
}
Ok
(
_
)
|
Err
(
_
)
=>
break
,
Ok
(
_
)
|
Err
(
_
)
=>
break
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment