mirror of
https://github.com/go-i2p/goSam.git
synced 2025-06-09 01:25:33 -04:00
Fix issue where the control socket should not be used as a streamsession
This commit is contained in:
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
|
||||
USER_GH=eyedeekay
|
||||
VERSION=0.32.4
|
||||
VERSION=0.32.5
|
||||
packagename=gosam
|
||||
|
||||
echo: fmt
|
||||
|
10
accept.go
10
accept.go
@ -28,13 +28,21 @@ func (c *Client) ListenI2P(dest string) (net.Listener, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if c.d == nil {
|
||||
c.d, err = c.NewClient(c.NewID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("Listening on destination:", c.Base32()+".b32.i2p")
|
||||
|
||||
if c.debug {
|
||||
c.SamConn = WrapConn(c.SamConn)
|
||||
}
|
||||
|
||||
return c, nil
|
||||
return c.d, nil
|
||||
}
|
||||
|
||||
// Accept accepts a connection on a listening goSam.Client(Implements net.Listener)
|
||||
|
@ -24,9 +24,10 @@ type Client struct {
|
||||
fromport string
|
||||
toport string
|
||||
|
||||
SamConn net.Conn
|
||||
SamDGConn DatagramConn
|
||||
SamConn net.Conn // Control socket
|
||||
SamDGConn DatagramConn // Datagram socket
|
||||
rd *bufio.Reader
|
||||
d *Client
|
||||
|
||||
sigType string
|
||||
destination string
|
||||
|
10
dial.go
10
dial.go
@ -76,10 +76,16 @@ func (c *Client) DialStreamingContextFree(addr string) (net.Conn, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if c.d == nil {
|
||||
c.d, err = c.NewClient(c.NewID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
err = c.StreamConnect(addr)
|
||||
err = c.d.StreamConnect(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.SamConn, nil
|
||||
return c.d.SamConn, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user