Merge pull request #65 from DeadlySurgeon/master

Adds `Close()` function to RCONClientConn and RCONServerConn
This commit is contained in:
Tnze
2020-07-13 09:51:48 +08:00
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@ -177,12 +177,14 @@ func (r *RCONConn) RespCmd(resp string) error {
type RCONClientConn interface {
Cmd(cmd string) error
Resp() (resp string, err error)
Close() error
}
type RCONServerConn interface {
AcceptLogin(password string) error
AcceptCmd() (cmd string, err error)
RespCmd(resp string) error
Close() error
}
func ListenRCON(addr string) (*RCONListener, error) {

View File

@ -17,6 +17,8 @@ func server(t *testing.T, prepare chan<- int) {
if err != nil {
t.Fatal(err)
}
defer l.Close()
prepare <- 1
for {
@ -55,6 +57,7 @@ func client(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer conn.Close()
err = conn.Cmd("TEST COMMAND")
if err != nil {