// updateServer implement update the proxy server
updateServer implement update the proxy server
// updateServer implement update the proxy server
func updateServer(svcName string, ports []int32) error {
	st := addrByService.getAddrTable(svcName)
	if st == nil { 
		addServer(svcName, ports)
	} else {
		oldports := make([]int32, len(st.ports))
		copy(oldports, st.ports)
		for idx, oldport := range oldports {
			update := true
			for k, newport := range ports {
				if oldport == newport {
					ports = append(ports[:k], ports[k+1:]...)
					update = false
					break
				}
			}
			if update {
				fd := getAndSetSocket(st.lns[idx], true)
				epoll.EpollCtrlDel(fd)
				st.lns[idx].Close()
				st.lns = append(st.lns[:idx], st.lns[idx+1:]...)
				st.ports = append(st.ports[:idx], st.ports[idx+1:]...)
			}
		}
		addServer(svcName, ports)
	}
	return nil
}
func updateServer ( svcName string , ports [ ] int32 ) error { st := addrByService . getAddrTable ( svcName ) if st == nil { addServer ( svcName , ports ) } else { oldports := make ( [ ] int32 , len ( st . ports ) ) copy ( oldports , st . ports ) for idx , oldport := range oldports { update := true for k , newport := range ports { if oldport == newport { ports = append ( ports [ : k ] , ports [ k + 1 : ] ... ) update = false break } } if update { fd := getAndSetSocket ( st . lns [ idx ] , true ) epoll . EpollCtrlDel ( fd ) st . lns [ idx ] . Close ( ) st . lns = append ( st . lns [ : idx ] , st . lns [ idx + 1 : ] ... ) st . ports = append ( st . ports [ : idx ] , st . ports [ idx + 1 : ] ... ) } } addServer ( svcName , ports ) } return nil }
updateServer implement update the proxy server
updateServer implement update the proxy server
// if not exist