Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
484cdc1d
Commit
484cdc1d
authored
Mar 08, 2018
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let udp client/server session run
parent
09fe6560
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
change_log.md
change_log.md
+4
-0
conn.go
conn.go
+1
-1
server.go
server.go
+5
-0
No files found.
change_log.md
View file @
484cdc1d
...
...
@@ -11,6 +11,10 @@
## develop history ##
---
-
2018/03/08
> feature
*
1 add udp client and udp server
-
2017/05/02
> feature
*
1 set read/write deadline for every read/write action refers to fasthttp
...
...
conn.go
View file @
484cdc1d
...
...
@@ -10,7 +10,6 @@
package
getty
import
(
// "errors"
"compress/flate"
"crypto/tls"
"fmt"
...
...
@@ -581,6 +580,7 @@ func (u *gettyUDPConn) read(p []byte) (int, *net.UDPAddr, error) {
length
,
addr
,
err
=
u
.
conn
.
ReadFromUDP
(
p
)
}
else
{
length
,
err
=
u
.
conn
.
Read
(
p
)
addr
=
u
.
peerAddr
}
if
err
==
nil
{
atomic
.
AddUint32
(
&
u
.
readCount
,
uint32
(
length
))
...
...
server.go
View file @
484cdc1d
...
...
@@ -182,6 +182,10 @@ func (s *Server) listenUDP() error {
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"net.ListenUDP((udp, localAddr:%#v)"
,
localAddr
)
}
if
err
=
setUDPSocketOptions
(
udpConn
);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"setUDPSocketOptions(udpConn:%#v)"
,
udpConn
)
}
s
.
udpConn
=
udpConn
return
nil
...
...
@@ -268,6 +272,7 @@ func (s *Server) runUDPEventloop(newSession NewSessionCallback) {
if
err
:=
newSession
(
ss
);
err
!=
nil
{
panic
(
err
.
Error
())
}
ss
.
(
*
session
)
.
run
()
}
type
wsHandler
struct
{
...
...
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