예제 #1
0
파일: EFTPManager.cs 프로젝트: shirriff/IFS
        public static void SendFile(PUPPort destination, Stream data)
        {
            UInt32      socketID   = SocketIDGenerator.GetNextSocketID();
            EFTPChannel newChannel = new EFTPChannel(destination, socketID);

            _activeChannels.Add(socketID, newChannel);

            EFTPSend.StartSend(newChannel, data);
        }
예제 #2
0
        private EFTPSend(EFTPChannel channel, Stream data)
        {
            _data     = data;
            _channel  = channel;
            _sendDone = false;

            _workerThread = new Thread(SendWorker);
            _workerThread.Start();

            channel.OnDestroy += OnChannelDestroyed;
        }
예제 #3
0
파일: EFTPManager.cs 프로젝트: shirriff/IFS
        public static void RecvData(PUP p)
        {
            EFTPChannel channel = FindChannelForPup(p);

            if (channel == null)
            {
                Log.Write(LogType.Error, LogComponent.EFTP, "Received EFTP PUP on an unconnected socket, ignoring.");
                return;
            }

            switch (p.Type)
            {
            case PupType.EFTPData:
            {
                channel.RecvData(p);
            }
            break;

            case PupType.EFTPAck:
            {
                channel.RecvAck(p);
            }
            break;

            case PupType.EFTPEnd:
            {
                channel.End(p);
            }
            break;

            case PupType.EFTPAbort:
            {
                string abortMessage = Helpers.ArrayToString(p.Contents);
                Log.Write(LogType.Warning, LogComponent.RTP, String.Format("EFTP aborted, message: '{0}'", abortMessage));

                DestroyChannel(channel);
            }
            break;

            default:
                throw new NotImplementedException(String.Format("Unhandled EFTP PUP type {0}.", p.Type));
            }
        }
예제 #4
0
 public static void StartSend(EFTPChannel channel, Stream data)
 {
     EFTPSend newSender = new EFTPSend(channel, data);
 }
예제 #5
0
파일: EFTPManager.cs 프로젝트: shirriff/IFS
        /// <summary>
        /// Destroys and unregisters the specified channel.
        /// </summary>
        /// <param name="channel"></param>
        public static void DestroyChannel(EFTPChannel channel)
        {
            channel.Destroy();

            _activeChannels.Remove(channel.ServerPort.Socket);
        }