Skip to content

Commit

Permalink
Use different ports in different tests; removed debug output; missing…
Browse files Browse the repository at this point in the history
… error handling
  • Loading branch information
gpayer committed May 3, 2021
1 parent e599b12 commit 4351418
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion osc/osc.go
Expand Up @@ -563,7 +563,6 @@ func (c *Client) Connect() error {
return err
}
c.server.SetConnection(c.conn)
fmt.Println("DEBUG: client connected")
return nil
}

Expand Down Expand Up @@ -695,6 +694,9 @@ func (s *Server) ReceivePacket() (Packet, error) {

// readFromConnection retrieves OSC packets.
func (s *Server) readFromConnection() (Packet, error) {
if s.conn == nil {
return nil, errors.New("not connected")
}
if s.ReadTimeout != 0 {
if err := s.conn.SetReadDeadline(time.Now().Add(s.ReadTimeout)); err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion osc/osc_test.go
Expand Up @@ -673,8 +673,9 @@ func TestServerSend(t *testing.T) {

func TestClientRecv(t *testing.T) {
targetServer := Server{
Addr: "127.0.0.1:6677",
Addr: "127.0.0.1:6678",
}
defer targetServer.CloseConnection()

go func() {
d := NewStandardDispatcher()
Expand Down Expand Up @@ -705,6 +706,7 @@ func TestClientRecv(t *testing.T) {

msg := NewMessage("/message/test")
err := client.Send(msg)
defer client.Close()
if err != nil {
t.Errorf("SendTo failed: %v", err)
}
Expand Down

0 comments on commit 4351418

Please sign in to comment.