Merge pull request #65 from DeadlySurgeon/master
Adds `Close()` function to RCONClientConn and RCONServerConn
This commit is contained in:
@ -177,12 +177,14 @@ func (r *RCONConn) RespCmd(resp string) error {
|
|||||||
type RCONClientConn interface {
|
type RCONClientConn interface {
|
||||||
Cmd(cmd string) error
|
Cmd(cmd string) error
|
||||||
Resp() (resp string, err error)
|
Resp() (resp string, err error)
|
||||||
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type RCONServerConn interface {
|
type RCONServerConn interface {
|
||||||
AcceptLogin(password string) error
|
AcceptLogin(password string) error
|
||||||
AcceptCmd() (cmd string, err error)
|
AcceptCmd() (cmd string, err error)
|
||||||
RespCmd(resp string) error
|
RespCmd(resp string) error
|
||||||
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func ListenRCON(addr string) (*RCONListener, error) {
|
func ListenRCON(addr string) (*RCONListener, error) {
|
||||||
|
@ -17,6 +17,8 @@ func server(t *testing.T, prepare chan<- int) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer l.Close()
|
||||||
|
|
||||||
prepare <- 1
|
prepare <- 1
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -55,6 +57,7 @@ func client(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
|
||||||
err = conn.Cmd("TEST COMMAND")
|
err = conn.Cmd("TEST COMMAND")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user