Exemple #1
0
        protected override void onDispose()
        {
            base.onDispose();
            handler.PostDelayed(new Runnable(() =>
            {
                ThreadProxy.getInstance().execute(new Runnable(() =>
                {
                    if (session.receiveByteNum == 0 && session.bytesSent == 0)
                    {
                        return;
                    }

                    string configFileDir = $"{VPNConstants.CONFIG_DIR}{TimeFormatUtil.formatYYMMDDHHMMSS(session.vpnStartTime)}";
                    var parentFile       = new File(configFileDir);

                    if (!parentFile.Exists())
                    {
                        parentFile.Mkdirs();
                    }

                    var file = new File(parentFile, session.getUniqueName());

                    if (file.Exists())
                    {
                        return;
                    }

                    ACache configACache = ACache.get(parentFile);

                    configACache.put(session.getUniqueName(), session);
                }));
            }), 1000);
        }
Exemple #2
0
        public RemoteTcpTunnel(InetSocketAddress serverAddress, Selector selector, short portKey, Context context) : base(serverAddress, selector, portKey)
        {
            this.context = context;
            session      = NatSessionManager.getSession(portKey);
            string helperDir = new StringBuilder()
                               .Append(VPNConstants.DATA_DIR)
                               .Append(TimeFormatUtil.formatYYMMDDHHMMSS(session.vpnStartTime))
                               .Append("/")
                               .Append(session.getUniqueName())
                               .ToString();

            helper  = new TcpDataSaveHelper(helperDir, context);
            handler = new Handler(Looper.MainLooper);
        }