// ZMQ_GSSAPI_SERVER: Set GSSAPI server role
//
// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1
//
// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc13
340395
func (soc *Socket) SetGssapiServer(value bool) error {
	if minor < 1 {
		return ErrorNotImplemented41
	}
	val := 0
	if value {
		val = 1
	}
	return soc.setInt(C.ZMQ_GSSAPI_SERVER, val)
}
1119524
func (s *PutAppReplicationConfigurationInput) SetServerGroupReplicationConfigurations(v []*ServerGroupReplicationConfiguration) *PutAppReplicationConfigurationInput {
	s.ServerGroupReplicationConfigurations = v
	return s
}
586151
func (soc *Socket) SetXpubVerboser(value int) error {
	if minor < 2 {
		return ErrorNotImplemented42
	}
	return soc.setInt(C.ZMQ_XPUB_VERBOSER, value)
}
147155
func (cm *ClientManager) SetServiceResolver(sr ServiceResolver) {
	if sr != nil {
		cm.serviceResolver = sr
	}
}
1296617
func (soc *Socket) SetCurveServerkey(key string) error {
	return soc.setString(C.ZMQ_CURVE_SERVERKEY, key)
}
345400
func buildGRPCServer(typeOfPlugin pluginType, name string, version int, arg *Arg, opts ...MetaOpt) (server *grpc.Server, m *meta, err error) {
	var grpcOptions []grpc.ServerOption

	m = newMeta(typeOfPlugin, name, version, opts...)
	grpcOptions = append(grpcOptions, m.grpcServerOptions...)

	if err := applySecurityArgsToMeta(m, arg); err != nil {
		return nil, nil, err
	}
	creds, err := makeGRPCCredentials(m)
	if err != nil {
		return nil, nil, err
	}
	if m.TLSEnabled {
		grpcOptions = append(grpcOptions, grpc.Creds(creds))
	} 
	server = grpc.NewServer(tlsSetup.updateServerOptions(grpcOptions...)...)
	return server, m, nil
}
782592
func (s *GetAppReplicationConfigurationOutput) SetServerGroupReplicationConfigurations(v []*ServerGroupReplicationConfiguration) *GetAppReplicationConfigurationOutput {
	s.ServerGroupReplicationConfigurations = v
	return s
}
514124
func (g *GSLB) SetSorryServer(server string) {
	g.Settings.GSLB.SorryServer = server
}
156938
func (gServer *GRPCServer) MutualTLSRequired() bool {
	return gServer.tlsConfig != nil &&
		gServer.tlsConfig.ClientAuth ==
			tls.RequireAndVerifyClientCert
}
522057
func (m *MemoryStore) SetMulti(metas map[string][]byte) error {
	for role, blob := range metas {
		m.Set(role, blob)
	}
	return nil
}
790208
func (tsv *TabletServer) SetQueryPoolWaiterCap(val int64) {
	tsv.qe.queryPoolWaiterCap.Set(val)
}
551835
func (r roleResponse) asServerRole(ctx context.Context, c *client) (ServerRole, error) {
	switch r.Role {
	case "SINGLE":
		switch r.Mode {
		case "resilient":
			if err := c.echo(ctx); IsNoLeader(err) {
				return ServerRoleSinglePassive, nil
			} else if err != nil {
				return ServerRoleUndefined, WithStack(err)
			}
			return ServerRoleSingleActive, nil
		default:
			return ServerRoleSingle, nil
		}
	case "PRIMARY":
		return ServerRoleDBServer, nil
	case "COORDINATOR":
		return ServerRoleCoordinator, nil
	case "AGENT":
		return ServerRoleAgent, nil
	case "UNDEFINED":
		return ServerRoleUndefined, nil
	default:
		return ServerRoleUndefined, nil
	}
}
1160411
func (soc *Socket) SetXpubNodrop(value bool) error {
	if minor < 1 {
		return ErrorNotImplemented41
	}
	val := 0
	if value {
		val = 1
	}
	return soc.setInt(C.ZMQ_XPUB_NODROP, val)
}
639504
func StartServer(info ServerInfo, opts ...grpc.ServerOption) func() {
	opts = append(opts, grpc.WriteBufferSize(128*1024))
	opts = append(opts, grpc.ReadBufferSize(128*1024))
	s := grpc.NewServer(opts...)
	switch info.Type {
	case "protobuf":
		testpb.RegisterBenchmarkServiceServer(s, &testServer{})
	case "bytebuf":
		respSize, ok := info.Metadata.(int32)
		if !ok {
			grpclog.Fatalf("failed to StartServer, invalid metadata: %v, for Type: %v", info.Metadata, info.Type)
		}
		testpb.RegisterBenchmarkServiceServer(s, &byteBufServer{respSize: respSize})
	default:
		grpclog.Fatalf("failed to StartServer, unknown Type: %v", info.Type)
	}
	go s.Serve(info.Listener)
	return func() {
		s.Stop()
	}
}
747383
func (gs *GRPCClient) AddServer(sv *Server) {
	var host, port, portKey string
	var ok bool

	host, portKey = gs.getServerHost(sv)
	if host == "" {
		logger.Log.Errorf("server %s has no grpcHost specified in metadata", sv.ID)
		return
	}

	if port, ok = sv.Metadata[portKey]; !ok {
		logger.Log.Errorf("server %s has no %s specified in metadata", sv.ID, portKey)
		return
	}

	address := fmt.Sprintf("%s:%s", host, port)
	conn, err := grpc.Dial(address, grpc.WithInsecure())
	if err != nil {
		logger.Log.Errorf("unable to connect to server %s at %s: %v", sv.ID, address, err)
		return
	}
	c := protos.NewPitayaClient(conn)
	gs.clientMap.Store(sv.ID, c)
	logger.Log.Debugf("[grpc client] added server %s at %s", sv.ID, address)
}
3356
func (soc *Socket) SetTcpKeepaliveIdle(value int) error {
	return soc.setInt(C.ZMQ_TCP_KEEPALIVE_IDLE, value)
}
840516
func RunGRPCServer() error {
	if !gorush.PushConf.GRPC.Enabled {
		gorush.LogAccess.Debug("gRPC server is disabled.")
		return nil
	}

	lis, err := net.Listen("tcp", ":"+gorush.PushConf.GRPC.Port)
	if err != nil {
		gorush.LogError.Errorf("failed to listen: %v", err)
		return err
	}
	s := grpc.NewServer()
	srv := NewServer()
	proto.RegisterGorushServer(s, srv)
	proto.RegisterHealthServer(s, srv)
	// Register reflection service on gRPC server.
	reflection.Register(s)
	gorush.LogAccess.Debug("gRPC server is running on " + gorush.PushConf.GRPC.Port + " port.")
	if err := s.Serve(lis); err != nil {
		gorush.LogError.Errorf("failed to serve: %v", err)
		return err
	}

	return nil
}