public void Handle() { NetworkStream networkStream = null; try { bool loop = true; IPEndPoint ipep = (IPEndPoint)Socket.RemoteEndPoint; IPAddress = ipep.Address; networkStream = new NetworkStream(Socket); try { Session = new SecureSession(networkStream, Certificates.SecurityParameters); Session.PerformServerHandshake(Certificates.Certificate); } catch { loop = false; } while (loop) { HydraRequest request = null; try { request = new HydraRequest(this); } catch { break; } Modules.IModule module = null; switch (request.Module) { case "feed": { module = new Modules.FeedModule(this); break; } case "profile": { module = new Modules.ProfileModule(this); break; } case "onesite_proxy": { module = new Modules.OnesiteProxyModule(this); break; } case "ugc": { module = new Modules.UgcModule(this); break; } default: { HydraResponse response = new HydraResponse(this); response.StatusCode = 404; response.Status = "File Not Found"; response.Payload = new byte[0]; response.Send(); break; } } if (module != null) module.HandleRequest(request); } } catch (Exception ex) { } try { Session.Close(); networkStream.Flush(); networkStream.Close(); Socket.Disconnect(false); Socket.Dispose(); } catch { } }