Skip to content

Commit

Permalink
Hacking on tcpdup
Browse files Browse the repository at this point in the history
  • Loading branch information
mrb committed Jan 8, 2013
1 parent f42f9b5 commit b845d04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/tcpudp/main.go
Expand Up @@ -39,14 +39,16 @@ func tcpConnectAndRead(c syl.Channels) {
for {
select {
case <-c.Control:
tcpConnectAndRead(c)
_, tcpConnector := maketcpConnecter()
go tcpConnector(c)
}
}
}

func maketcpConnecter() (tcp *net.TCPConn, event syl.Event) {
event = func(c syl.Channels) {
var err error
log.Print("tcp? ", tcp)
tcp, err = conn.TcpConnect("localhost:2323")

if err != nil {
Expand All @@ -66,7 +68,7 @@ func maketcpReader(tcp *net.TCPConn) (event syl.Event) {
dlen, err := tcp.Read(data)
if err != nil {
log.Print(err)
c.Error <- syl.NewEventError(c.NodeId, err)
c.Error <- err
return
}
log.Printf("...read %d bytes from TCP", dlen)
Expand Down

0 comments on commit b845d04

Please sign in to comment.