Skip to content

Commit

Permalink
try to make connection work, not successfull yet
Browse files Browse the repository at this point in the history
  • Loading branch information
ashellunts committed Oct 24, 2021
1 parent ab423b8 commit a6ff55d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Adam Kiss <masterada@gmail.com>
adwpc <adwpc@hotmail.com>
Aleksandr Razumov <ar@gortc.io>
Antoine Baché <antoine@tenten.app>
Artur Shellunts <shellunts.artur@gmail.com>
Assad Obaid <assad@lap5cg901003r.se.axis.com>
Atsushi Watanabe <atsushi.w@ieee.org>
backkem <mail@backkem.me>
Expand All @@ -16,6 +17,7 @@ cgojin <gongjin21@hotmail.com>
Chao Yuan <yuanchao0310@163.com>
David Hamilton <davidhamiltron@gmail.com>
David Zhao <david@davidzhao.com>
Devin Gunay <devingunay@gmail.com>
Henry <cryptix@riseup.net>
hn8 <10730886+hn8@users.noreply.github.com>
Hugo Arregui <hugo.arregui@gmail.com>
Expand Down
10 changes: 9 additions & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package ice

import (
"context"
"fmt"
"net"
"strings"
"sync"
Expand Down Expand Up @@ -814,7 +815,10 @@ func (a *Agent) addRemoteCandidate(c Candidate) {
// Open a TCP socket if the remote candidate is passive TCP
// TODO: only open the socket if the remote actually exists
if c.TCPType() == TCPTypePassive {
conn, err := net.Dial("tcp", c.Address())
str := c.Address()
fmt.Println(str)
addressToConnect := c.Address() + ":" + fmt.Sprint(c.Port())
conn, err := net.Dial("tcp", addressToConnect)
if err != nil {
// TODO: what is the typical Pion error handling strategy here?
a.log.Warnf("Failed to open a TCP connection to %s: %v", c.Address(), err)
Expand Down Expand Up @@ -1099,11 +1103,15 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)

if remoteCandidate == nil {
ip, port, networkType, ok := parseAddr(remote)
print("recieved candidate ", ip, port, networkType, ok)

if !ok {
a.log.Errorf("Failed to create parse remote net.Addr when creating remote prflx candidate")
return
}

port = 7686

prflxCandidateConfig := CandidatePeerReflexiveConfig{
Network: networkType.String(),
Address: ip.String(),
Expand Down
2 changes: 1 addition & 1 deletion agent_tcpmux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestTCPMuxAgent(t *testing.T) {
report := test.CheckRoutines(t)
defer report()

lim := test.TimeOut(time.Second * 30)
lim := test.TimeOut(time.Second * 30000)
defer lim.Stop()

const muxPort = 7686
Expand Down
2 changes: 1 addition & 1 deletion gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (a *Agent) gatherCandidatesLocal(ctx context.Context, networkTypes []Networ
a.tcpConnections[ip.String()] = nil
haveSetupActiveTCP = true
tcpType = TCPTypeActive
port = 0 // TODO: not sure what to do here yet
port = 7686 // TODO: not sure what to do here yet
} else {
// Handle ICE TCP passive mode
a.log.Debugf("GetConn by ufrag: %s\n", a.localUfrag)
Expand Down

0 comments on commit a6ff55d

Please sign in to comment.