Example #1
0
func (l *ofListener) startOFConn(conn net.Conn, ctx bh.RcvContext) {
	ofc := &ofConn{
		HeaderConn: of.NewHeaderConn(conn),
		readBufLen: l.readBufLen,
	}

	ctx.StartDetached(ofc)
}
Example #2
0
// Start is called once the detached handler starts.
func (h *HelloListener) Start(ctx beehive.RcvContext) {
	defer h.lis.Close()

	for {
		c, err := h.lis.Accept()
		if err != nil {
			return
		}
		// Start a new detached handler for the connection.
		go ctx.StartDetached(&HelloConn{conn: c})
	}
}
Example #3
0
func (h *ProtoHandler) Start(ctx beehive.RcvContext) {
	defer close(h.done)

	glog.Infof("taskq is listening on: %s", h.lis.Addr())

	for {
		c, err := h.lis.Accept()
		if err != nil {
			if nerr, ok := err.(net.Error); ok && nerr.Temporary() {
				continue
			}
			return
		}

		// TODO(soheil): do we need to be graceful for connections?
		go ctx.StartDetached(NewConnHandler(c))
	}
}