| 778 | |
| 779 | |
| 780 | public void init() throws Exception { |
| 781 | List<Protocol> protocols=getProtocols(); |
| 782 | Collections.reverse(protocols); |
| 783 | top_prot=Configurator.connectProtocols(protocols); |
| 784 | top_prot.setUpProtocol(this); |
| 785 | this.setDownProtocol(top_prot); |
| 786 | bottom_prot=getBottomProtocol(); |
| 787 | |
| 788 | StackType ip_version=Util.getIpStackType(); |
| 789 | TP tp=getTransport(); |
| 790 | InetAddress resolved_addr=tp != null? tp.getBindAddress() : null; |
| 791 | if(resolved_addr != null) |
| 792 | ip_version=resolved_addr instanceof Inet6Address? StackType.IPv6 : StackType.IPv4; |
| 793 | else if(ip_version == StackType.Dual) |
| 794 | ip_version=StackType.IPv4; // prefer IPv4 addresses |
| 795 | Configurator.setDefaultAddressValues(protocols, ip_version); |
| 796 | initProtocolStack(null); |
| 797 | } |
| 798 | |
| 799 | |
| 800 | /** Calls @link{{@link Protocol#init()}} in all protocols, from bottom to top */ |