Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
83e9f4c9
Commit
83e9f4c9
authored
Jul 12, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5996305f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
9 deletions
+4
-9
DeviceServerHandler.java
.../java/iot/sixiang/license/device/DeviceServerHandler.java
+4
-4
ForwardClientHandler.java
...ava/iot/sixiang/license/forward/ForwardClientHandler.java
+0
-5
No files found.
license/src/main/java/iot/sixiang/license/device/DeviceServerHandler.java
View file @
83e9f4c9
...
...
@@ -63,9 +63,9 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
auth
=
handlerCheckAuth
(
channel
,
remoteIp
,
remotePort
,
protocol
);
}
else
{
auth
=
handlerCheckAuthStatus
(
channel
,
remoteIp
,
remotePort
,
protocol
);
auth
=
handlerCheckAuthStatus
(
channel
);
if
(
auth
)
{
handlerForward
(
channel
,
remoteIp
,
remotePort
,
protocol
);
handlerForward
(
channel
,
protocol
);
}
}
...
...
@@ -163,13 +163,13 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
return
license
;
}
private
boolean
handlerCheckAuthStatus
(
SocketChannel
channel
,
String
remoteIp
,
int
remotePort
,
DeviceProtocol
protocol
)
{
private
boolean
handlerCheckAuthStatus
(
SocketChannel
channel
)
{
String
channelId
=
channel
.
id
().
asLongText
();
DeviceManager
deviceManager
=
SpringUtil
.
getBean
(
DeviceManager
.
class
);
return
deviceManager
.
getAuthStatusByChannelId
(
channelId
);
}
private
void
handlerForward
(
SocketChannel
channel
,
String
remoteIp
,
int
remotePort
,
DeviceProtocol
protocol
)
{
private
void
handlerForward
(
SocketChannel
channel
,
DeviceProtocol
protocol
)
{
String
channelId
=
channel
.
id
().
asLongText
();
ForwardClientRequestEvent
forwardClientRequestEvent
=
new
ForwardClientRequestEvent
();
forwardClientRequestEvent
.
setDeviceChannelId
(
channelId
);
...
...
license/src/main/java/iot/sixiang/license/forward/ForwardClientHandler.java
View file @
83e9f4c9
...
...
@@ -13,8 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.net.InetSocketAddress
;
@Component
@ChannelHandler
.
Sharable
@Slf4j
...
...
@@ -33,9 +31,6 @@ public class ForwardClientHandler extends SimpleChannelInboundHandler<Object> {
// TODO Auto-generated method stub
// TODO 中转客户端收到消息后,将消息原封不动的发送给设备客户端
SocketChannel
channel
=
(
SocketChannel
)
ctx
.
channel
();
InetSocketAddress
socketAddr
=
(
InetSocketAddress
)
ctx
.
channel
().
remoteAddress
();
String
serverIp
=
socketAddr
.
getHostString
();
int
serverPort
=
socketAddr
.
getPort
();
DeviceProtocol
protocol
=
(
DeviceProtocol
)
msg
;
String
channelId
=
channel
.
id
().
asLongText
();
log
.
debug
(
"桥接客户端,channelRead0:{},{}"
,
channelId
,
HexUtil
.
bytes2hex
(
protocol
.
getContent
()));
...
...
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