// Start initializes the RPC channels and starts a goroutine to listen for incoming RPC requests
429599
func (s *Service) Start() error {
	err := s.startChannel()
	if err != nil {
		return err
	}

	s.wg.Add(1)
	go func() {
		defer s.wg.Done()

		// Same polling interval and backoff logic as vmtoolsd.
		// Required in our case at startup at least, otherwise it is possible
		// we miss the 1 Capabilities_Register call for example.

		// Note we Send(response) even when nil, to let the VMX know we are here
		var response []byte

		for {
			select {
			case <-s.stop:
				s.stopChannel()
				return
			case <-time.After(time.Millisecond * 10 * s.delay):
				if err = s.checkReset(); err != nil {
					continue
				}

				err = s.in.Send(response)
				response = nil
				if err != nil {
					s.delay = resetDelay
					s.rpcError = true
					continue
				}

				request, _ := s.in.Receive()

				if len(request) > 0 {
					response = s.Dispatch(request)

					s.delay = 0
				} else {
					s.backoff()
				}
			}
		}
	}()

	return nil
}
321391
func (c *PCPClient) Start() error {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	l := c.Length()

	writer, err := bytewriter.NewMemoryMappedWriter(c.loc, l)
	if err != nil {
		return errors.Wrap(err, "cannot create MemoryMappedBuffer in client")
	}

	c.writer = writer
	c.start()
	c.r.mapped = true
	return nil
}
357342
func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*shimapi.StartResponse, error) {
	p, err := s.getExecProcess(r.ID)
	if err != nil {
		return nil, err
	}
	if err := p.Start(ctx); err != nil {
		return nil, err
	}
	return &shimapi.StartResponse{
		ID:  p.ID(),
		Pid: uint32(p.Pid()),
	}, nil
}
1308852
func (i *ChannelInbound) Start() error {
	return i.once.Start(func() error {
		i.transport.logger.Info("started TChannel inbound", zap.String("address", i.transport.ListenAddr()))
		if i.transport.router == nil || len(i.transport.router.Procedures()) == 0 {
			i.transport.logger.Warn("no procedures specified for tchannel inbound")
		}
		return nil
	})
}
478628
func (s *sdkGrpcServer) Start() error {

	// Setup https if certs have been provided
	opts := make([]grpc.ServerOption, 0)
	if s.config.Net != "unix" && s.config.Security.Tls != nil {
		creds, err := credentials.NewServerTLSFromFile(
			s.config.Security.Tls.CertFile,
			s.config.Security.Tls.KeyFile)
		if err != nil {
			return fmt.Errorf("Failed to create credentials from cert files: %v", err)
		}
		opts = append(opts, grpc.Creds(creds))
		s.log.Info("SDK TLS enabled")
	} else {
		s.log.Info("SDK TLS disabled")
	}

	// Setup authentication and authorization using interceptors if auth is enabled
	if len(s.config.Security.Authenticators) != 0 {
		opts = append(opts, grpc.UnaryInterceptor(
			grpc_middleware.ChainUnaryServer(
				s.rwlockIntercepter,
				grpc_auth.UnaryServerInterceptor(s.auth),
				s.authorizationServerInterceptor,
				s.loggerServerInterceptor,
			)))
	} else {
		opts = append(opts, grpc.UnaryInterceptor(
			grpc_middleware.ChainUnaryServer(
				s.rwlockIntercepter,
				s.loggerServerInterceptor,
			)))
	}

	// Start the gRPC Server
	err := s.GrpcServer.StartWithServer(func() *grpc.Server {
		grpcServer := grpc.NewServer(opts...)

		api.RegisterOpenStorageClusterServer(grpcServer, s.clusterServer)
		api.RegisterOpenStorageNodeServer(grpcServer, s.nodeServer)
		api.RegisterOpenStorageObjectstoreServer(grpcServer, s.objectstoreServer)
		api.RegisterOpenStorageSchedulePolicyServer(grpcServer, s.schedulePolicyServer)
		api.RegisterOpenStorageIdentityServer(grpcServer, s.identityServer)
		api.RegisterOpenStorageVolumeServer(grpcServer, s.volumeServer)
		api.RegisterOpenStorageMigrateServer(grpcServer, s.volumeServer)
		api.RegisterOpenStorageCredentialsServer(grpcServer, s.credentialServer)
		api.RegisterOpenStorageCloudBackupServer(grpcServer, s.cloudBackupServer)
		api.RegisterOpenStorageMountAttachServer(grpcServer, s.volumeServer)
		api.RegisterOpenStorageAlertsServer(grpcServer, s.alertsServer)
		api.RegisterOpenStorageClusterPairServer(grpcServer, s.clusterPairServer)
		api.RegisterOpenStoragePolicyServer(grpcServer, s.policyServer)
		api.RegisterOpenStorageClusterDomainsServer(grpcServer, s.clusterDomainsServer)

		if s.config.Security.Role != nil {
			api.RegisterOpenStorageRoleServer(grpcServer, s.roleServer)
		}

		s.RegisterServerExtensions(grpcServer)

		return grpcServer
	})
	if err != nil {
		return err
	}

	return nil
}
658980
func (q *queue) Start() {

	q.mutex.Lock()
	defer q.mutex.Unlock()

	if q.status == queueStopped {
		q.status = queueRunning
		go q.start()
	}
}
227739
func (s *Server) Start() error {
	if s.config.Listener == nil {
		err := s.config.InitListener()
		if err != nil {
			return err
		}
	}
	s.config.Print(`standard`)
	return s.Serve(s.config.Listener)
}
185410
func Start() {
	tchannelTransport, err := tchannel.NewChannelTransport(
		tchannel.ListenAddr(":8082"),
		tchannel.ServiceName("yarpc-test"),
	)
	if err != nil {
		log.Panicf("failed to build ChannelTransport: %v", err)
	}
	grpcListener, err := net.Listen("tcp", ":8089")
	if err != nil {
		log.Panic(err)
	}

	httpTransport := http.NewTransport()
	dispatcher = yarpc.NewDispatcher(yarpc.Config{
		Name: "yarpc-test",
		Inbounds: yarpc.Inbounds{
			tchannelTransport.NewInbound(),
			httpTransport.NewInbound(":8081"),
			grpc.NewTransport().NewInbound(grpcListener),
		},
	})

	register(dispatcher)

	if err := dispatcher.Start(); err != nil {
		fmt.Println("error:", err.Error())
	}
}
125374
func (s *dockerLoggerServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.StartResponse, error) {
	opts := &StartOpts{
		Endpoint:    req.Endpoint,
		ContainerID: req.ContainerId,
		Stdout:      req.StdoutFifo,
		Stderr:      req.StderrFifo,
		TTY:         req.Tty,

		TLSCert: req.TlsCert,
		TLSKey:  req.TlsKey,
		TLSCA:   req.TlsCa,
	}
	err := s.impl.Start(opts)
	if err != nil {
		return nil, err
	}
	resp := &proto.StartResponse{}
	return resp, nil
}
803474
func (s *Server) Start(loopFn func(IOSession) error) error {
	addr, err := net.ResolveTCPAddr("tcp", s.addr)

	if err != nil {
		return err
	}

	s.listener, err = net.ListenTCP("tcp", addr)

	if err != nil {
		return err
	}

	s.startCh <- struct{}{}

	var tempDelay time.Duration
	for {
		conn, err := s.listener.AcceptTCP()

		if s.stopped {
			if nil != conn {
				conn.Close()
			}

			return nil
		}

		if err != nil {
			if ne, ok := err.(net.Error); ok && ne.Temporary() {
				if tempDelay == 0 {
					tempDelay = 5 * time.Millisecond
				} else {
					tempDelay *= 2
				}
				if max := 1 * time.Second; tempDelay > max {
					tempDelay = max
				}
				time.Sleep(tempDelay)
				continue
			}
			return err
		}
		tempDelay = 0

		session := newClientIOSession(s.opts.generator.NewID(), conn, s)
		s.addSession(session)

		go func() {
			defer func() {
				if err := recover(); err != nil {
					const size = 64 << 10
					rBuf := make([]byte, size)
					rBuf = rBuf[:runtime.Stack(rBuf, false)]
					log.Printf("goetty: connection painc %+v, stack:\n%s",
						err,
						rBuf)
				}
			}()

			loopFn(session)
			session.Close()
			s.deleteSession(session)
		}()
	}
}
727089
func (f *FastHTTPServer) Start() {
	go func() {
		time.Sleep(100 * time.Millisecond)
		fmt.Printf("\nListening on fasthttp %s...\n", f.ServerInit.Address)
	}()
	if f.ServerInit.Network == "tcp" {
		f.ServerInit.Network = "tcp4"
	}
	listener, err := reuseport.Listen(f.ServerInit.Network, f.ServerInit.Address)
	if err != nil {
		serverLog.Fatal("Failed to listen http:", "error", err, "network", f.ServerInit.Network, "address", f.ServerInit.Address)
	}

	// create a graceful shutdown listener
	duration := 5 * time.Second
	f.graceful = NewGracefulListener(listener, duration)

	if revel.HTTPSsl {
		if f.ServerInit.Network != "tcp" {
			// This limitation is just to reduce complexity, since it is standard
			// to terminate SSL upstream when using unix domain sockets.
			serverLog.Fatal("SSL is only supported for TCP sockets. Specify a port to listen on.")
		}
		serverLog.Fatal("Failed to listen https:", "error",
			f.Server.ServeTLS(f.graceful, revel.HTTPSslCert, revel.HTTPSslKey))
	} else {

		serverLog.Info("Listening fasthttp ", f.ServerInit.Network, f.ServerInit.Address)
		serverLog.Warn("Server exiting", "error", f.Server.Serve(f.graceful))
	}
}
1222230
func (f *Fetcher) Start() *Queue {
	f.hosts = make(map[string]chan Command)

	f.q = &Queue{
		ch:        make(chan Command, 1),
		closed:    make(chan struct{}),
		cancelled: make(chan struct{}),
		done:      make(chan struct{}),
	}

	// Start the one and only queue processing goroutine.
	f.q.wg.Add(1)
	go f.processQueue()

	return f.q
}
1015863
func (whisper *Whisper) Start(*p2p.Server) error {
	log.Info("started whisper v." + ProtocolVersionStr)
	go whisper.update()

	numCPU := runtime.NumCPU()
	for i := 0; i < numCPU; i++ {
		go whisper.processQueue()
	}

	return nil
}
203988
func (tc *Consumer) Start() error {
	log.Info("Starting TCP consumer")
	tcpAddr, err := net.ResolveTCPAddr("tcp", tc.address)
	if err != nil {
		return err
	}

	listener, err := net.ListenTCP("tcp", tcpAddr)
	if err != nil {
		return err
	}

	log.Info("Listening TCP at %s", tc.address)
	go tc.closeListener(listener)
	go tc.listen(listener)

	return nil
}
257913
func (p *Process) Start() error {
	p.mtx.Lock()
	defer p.mtx.Unlock()

	// Valdiate that process is not already running and that we have a config.
	if p.running {
		return ErrRunning
	}
	return p.start()
}
624413
func (s *Ethereum) Start(srvr *p2p.Server) error {
	// Start the bloom bits servicing goroutines
	s.startBloomHandlers(params.BloomBitsBlocks)

	// Start the RPC service
	s.netRPCService = ethapi.NewPublicNetAPI(srvr, s.NetVersion())

	// Figure out a max peers count based on the server limits
	maxPeers := srvr.MaxPeers
	if s.config.LightServ > 0 {
		if s.config.LightPeers >= srvr.MaxPeers {
			return fmt.Errorf("invalid peer config: light peer count (%d) >= total peer count (%d)", s.config.LightPeers, srvr.MaxPeers)
		}
		maxPeers -= s.config.LightPeers
	}
	// Start the networking layer and the light server if requested
	s.protocolManager.Start(maxPeers)
	if s.lesServer != nil {
		s.lesServer.Start(srvr)
	}
	return nil
}
389369
func (c *Conn) Start() error {
	if c.Rwc == nil {
		return errors.New("No connection exists")
	}

	c.RwcScanner = bufio.NewScanner(c.Rwc)

	for c.state != StateLoggedOut {
		// Always send welcome message if we are still in new connection state
		if c.state == StateNew {
			c.sendWelcome()
		}

		// Await requests from the client
		req, ok := c.ReadLine()
		if !ok {
			// The client has closed the connection
			c.state = StateLoggedOut
			break
		}
		fmt.Fprintf(c.Transcript, "C: %s\n", req)
		c.handleRequest(req)

		if c.RwcScanner.Err() != nil {
			fmt.Fprintf(c.Transcript, "Scan error: %s\n", c.RwcScanner.Err())
		}
	}

	return nil
}