Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
golangphone10
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangjie
golangphone10
Commits
346879e5
Commit
346879e5
authored
Aug 21, 2021
by
zhangjiec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计socket连接数量的变量改为原子操作
parent
ab1316b4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
77 additions
and
23 deletions
+77
-23
config.ini
config.ini
+3
-4
dc_phone10_http_server.go
devproduct/dcphone10/dc_phone10_http_server.go
+19
-2
dc_phone10_para_json.go
devproduct/dcphone10/dc_phone10_para_json.go
+10
-0
dc_phone10_tcp.go
devproduct/dcphone10/dc_phone10_tcp.go
+34
-11
go.mod
go.mod
+1
-0
go.sum
go.sum
+2
-0
jeffutil_test.go
jeffutil/jeffutil_test.go
+7
-4
panic.log
log/panic.log
+0
-0
jeff_hex_server.go
tcplongserver/jeff_hex_server.go
+1
-2
No files found.
config.ini
View file @
346879e5
...
...
@@ -4,9 +4,8 @@ ServerMode = release
ServerPort
=
:50000
[http_client]
#BaseUrl = http://handandev.swaylink.cn/phone/2/server/
#BaseUrl = http://dev.lezhixy.com/phone/2/server/
BaseUrl
=
http://127.0.0.1:1234/phone/2/server/
BaseUrl
=
http://handandev.swaylink.cn/phone/2/server/
#BaseUrl = http://dev.lezhixy.com:5000/phone/2/server/
TimeOut
=
5
[tcp_long_server]
...
...
@@ -44,5 +43,5 @@ WarnWithMaxAge = 90
#Error级别日志最多保存多少份
ErrorMaxFileNum
=
10
#Error日志最长保留天数
#Error日志最长保留天数
s
ErrorWithMaxAge
=
180
devproduct/dcphone10/dc_phone10_http_server.go
View file @
346879e5
...
...
@@ -289,11 +289,11 @@ func (dev *DCPhone10) setDevPara(c *gin.Context) {
sTcpData
.
Data
[
0
]
=
data
.
Value
sTcpData
.
Length
=
1
sDevId
=
data
.
DevID
case
"key_password"
,
"
online_dial"
,
"
update_firmware"
,
"restart_device"
:
//
case
"key_password"
,
"update_firmware"
,
"restart_device"
:
//
var
data
paraOneString
if
err
:=
c
.
ShouldBindJSON
(
&
data
);
err
!=
nil
{
logger
.
Log
.
Error
(
"c.ShouldBindJSON(&data)"
,
zap
.
String
(
"Src"
,
"case
\"
key_password
\"
,
\"
online_dial
\"
,
\"
update_firmware
\"
,
\"
restart_device
\"
"
),
zap
.
String
(
"Src"
,
"case
\"
key_password
\"
,
\"
update_firmware
\"
,
\"
restart_device
\"
"
),
zap
.
Error
(
err
))
sTcpData
.
CtrlCode
=
0
returnState
=
2002
...
...
@@ -303,6 +303,23 @@ func (dev *DCPhone10) setDevPara(c *gin.Context) {
sTcpData
.
Data
=
[]
byte
(
data
.
Value
)
sTcpData
.
Length
=
byte
(
len
(
data
.
Value
))
sDevId
=
data
.
DevID
case
"online_dial"
:
var
data
structOnlineDial
if
err
:=
c
.
ShouldBindJSON
(
&
data
);
err
!=
nil
{
logger
.
Log
.
Error
(
"c.ShouldBindJSON(&data)"
,
zap
.
String
(
"Src"
,
"case
\"
online_dial
\"
"
),
zap
.
Error
(
err
))
sTcpData
.
CtrlCode
=
0
returnState
=
2002
returnMsg
=
"参数内容错误"
break
}
sTcpData
.
Data
[
0
]
=
data
.
Value
.
Time
sTcpData
.
Length
=
uint8
(
copy
(
sTcpData
.
Data
[
1
:
],
data
.
Value
.
Number
)
+
1
)
//sTcpData.Data = []byte(data.Value.Number)
//sTcpData.Length = byte(len(data.Value))
sDevId
=
data
.
DevID
break
case
"work_time"
:
// 工作时段
var
data
paraWorkTime
if
err
:=
c
.
ShouldBindJSON
(
&
data
);
err
!=
nil
{
...
...
devproduct/dcphone10/dc_phone10_para_json.go
View file @
346879e5
...
...
@@ -143,3 +143,13 @@ type paraWorkTime struct {
WeekDay
[]
bool
`json:"week_day"`
}
`json:"value"`
}
type
structOnlineDial
struct
{
DevTime
uint32
`json:"dev_send_time"`
DevID
[]
uint32
`json:"devId"`
Value
struct
{
Result
uint8
`json:"result"`
Time
uint8
`json:"time"`
Number
string
`json:"number"`
}
`json:"value"`
}
devproduct/dcphone10/dc_phone10_tcp.go
View file @
346879e5
This diff is collapsed.
Click to expand it.
go.mod
View file @
346879e5
...
...
@@ -20,6 +20,7 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/dl v0.0.0-20210816190658-eea66df5a73d // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/text v0.3.6 // indirect
...
...
go.sum
View file @
346879e5
...
...
@@ -77,6 +77,8 @@ go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.18.1 h1:CSUJ2mjFszzEWt4CdKISEuChVIXGBn3lAPwkRGyVrc4=
go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
golang.org/dl v0.0.0-20210816190658-eea66df5a73d h1:fY+sw1TVAhVSrszhxX7Ew04Y6V9Znfa8s5O1HTzTsOQ=
golang.org/dl v0.0.0-20210816190658-eea66df5a73d/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
...
...
jeffutil/jeffutil_test.go
View file @
346879e5
...
...
@@ -24,8 +24,11 @@ func TestHex2Cipher(t *testing.T) {
// }
// fmt.Println()
//}
a
:=
[]
byte
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
str
:=
string
(
a
)
fmt
.
Println
(
str
)
fmt
.
Println
(
len
(
str
))
var
b
[
3
]
byte
for
i
:=
10002
;
i
<=
11001
;
i
++
{
b
[
0
]
=
byte
(
i
)
b
[
1
]
=
byte
(
i
>>
8
)
b
[
2
]
=
byte
(
i
>>
16
)
fmt
.
Printf
(
"3D%02X%02X%02X,"
,
b
[
0
],
b
[
1
],
b
[
2
])
}
}
log/panic.log
deleted
100644 → 0
View file @
ab1316b4
tcplongserver/jeff_hex_server.go
View file @
346879e5
package
tcplongserver
import
(
"fmt"
"go.uber.org/zap"
"jeff_workstation_1/jeffutil"
"jeff_workstation_1/logger"
...
...
@@ -137,7 +136,7 @@ func (s *TCPLongServer) connectionHandle(conn *net.TCPConn, callBack receiveCall
}
_
=
conn
.
SetReadDeadline
(
time
.
Time
{})
// 设置回去,但是不知道需不需要这句话
_
=
conn
.
Close
()
fmt
.
Println
(
"-----------------------------------Out ConnSocketCount:"
,
s
.
ConnSocketCount
)
//
fmt.Println("-----------------------------------Out ConnSocketCount:", s.ConnSocketCount)
}()
//myDevId := -1
//waitTimeOut := 0
...
...
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