Skip to content

Commit

Permalink
Remove Reconnect and Disconnect from AdaptorInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Apr 16, 2014
1 parent 8d4a851 commit 646362a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 0 additions & 2 deletions adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ type Adaptor struct {
type AdaptorInterface interface {
Finalize() bool
Connect() bool
Disconnect() bool
Reconnect() bool
}
12 changes: 0 additions & 12 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ type connection struct {

type Connection interface {
Connect() bool
Disconnect() bool
Finalize() bool
Reconnect() bool
}

func NewConnection(adaptor AdaptorInterface, r *Robot) *connection {
Expand All @@ -38,17 +36,7 @@ func (c *connection) Connect() bool {
return c.Adaptor.Connect()
}

func (c *connection) Disconnect() bool {
log.Println("Disconnecting " + c.Name + "...")
return c.Adaptor.Disconnect()
}

func (c *connection) Finalize() bool {
log.Println("Finalizing " + c.Name + "...")
return c.Adaptor.Finalize()
}

func (c *connection) Reconnect() bool {
log.Println("Reconnecting to " + c.Name + " on port " + c.Port + "...")
return c.Adaptor.Reconnect()
}
6 changes: 2 additions & 4 deletions test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ type testAdaptor struct {
Adaptor
}

func (me *testAdaptor) Finalize() bool { return true }
func (me *testAdaptor) Connect() bool { return true }
func (me *testAdaptor) Disconnect() bool { return true }
func (me *testAdaptor) Reconnect() bool { return true }
func (me *testAdaptor) Finalize() bool { return true }
func (me *testAdaptor) Connect() bool { return true }

func newTestDriver(name string, adaptor *testAdaptor) *testDriver {
d := new(testDriver)
Expand Down

0 comments on commit 646362a

Please sign in to comment.