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
f83552e6
Commit
f83552e6
authored
Sep 26, 2016
by
alexstocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use goext
parent
99e8cdfa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
58 deletions
+7
-58
dev.list
dev.list
+3
-0
server.go
server.go
+2
-1
session.go
session.go
+2
-1
utils.go
utils.go
+0
-56
No files found.
dev.list
View file @
f83552e6
...
...
@@ -11,6 +11,9 @@
## develop history ##
---
- 2016/09/26
> 1 move utils.go's function to github.com/AlexStocks/goext and delete it
- 2016/09/20
> 1 just invoke OnError when session got error
>
...
...
server.go
View file @
f83552e6
...
...
@@ -17,6 +17,7 @@ import (
)
import
(
"github.com/AlexStocks/goext/net"
log
"github.com/AlexStocks/log4go"
)
...
...
@@ -67,7 +68,7 @@ func (this *Server) Bind(network string, host string, port int) error {
return
errors
.
New
(
"port<=0 illegal"
)
}
return
this
.
Listen
(
network
,
HostAddress
(
host
,
port
))
return
this
.
Listen
(
network
,
gxnet
.
HostAddress
(
host
,
port
))
}
func
(
this
*
Server
)
Listen
(
network
string
,
addr
string
)
error
{
...
...
session.go
View file @
f83552e6
...
...
@@ -21,6 +21,7 @@ import (
)
import
(
"github.com/AlexStocks/goext/time"
log
"github.com/AlexStocks/log4go"
)
...
...
@@ -361,7 +362,7 @@ func (this *Session) handleLoop() {
err
error
flag
bool
// start time.Time
counter
CountWatch
counter
gxtime
.
CountWatch
ticker
*
time
.
Ticker
inPkg
interface
{}
outPkg
interface
{}
...
...
utils.go
deleted
100644 → 0
View file @
99e8cdfa
/******************************************************
# DESC : getty utility
# AUTHOR : Alex Stocks
# LICENCE : Apache License 2.0
# EMAIL : alexstocks@foxmail.com
# MOD : 2016-08-22 17:44
# FILE : utils.go
******************************************************/
package
getty
import
(
"net"
"strconv"
"time"
)
/////////////////////////////////////////
// network utility
/////////////////////////////////////////
// HostAddress composes a ip:port style address. Its opposite function is net.SplitHostPort.
func
HostAddress
(
host
string
,
port
int
)
string
{
return
net
.
JoinHostPort
(
host
,
strconv
.
Itoa
(
port
))
}
func
HostAddress2
(
host
string
,
port
string
)
string
{
return
net
.
JoinHostPort
(
host
,
port
)
}
func
HostPort
(
addr
string
)
(
string
,
string
,
error
)
{
return
net
.
SplitHostPort
(
addr
)
}
/////////////////////////////////////////
// count watch
/////////////////////////////////////////
type
CountWatch
struct
{
start
time
.
Time
}
func
(
w
*
CountWatch
)
Start
()
{
var
t
time
.
Time
if
t
.
Equal
(
w
.
start
)
{
w
.
start
=
time
.
Now
()
}
}
func
(
w
*
CountWatch
)
Reset
()
{
w
.
start
=
time
.
Now
()
}
func
(
w
*
CountWatch
)
Count
()
int64
{
return
time
.
Since
(
w
.
start
)
.
Nanoseconds
()
}
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