<commit_before>﻿using System;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using ISDPP.UPnP.PCL.Interfaces.Model;
using ISDPP.UPnP.PCL.Interfaces.Service;
using ISimpleHttpServer.Service;
using SDPP.UPnP.PCL.Model;

namespace SDPP.UPnP.PCL.Service
{
    public class ControlPoint : IControlPoint
    {
        private readonly IHttpListener _httpListener;

        public IObservable<INotify> NotifyObservable =>
            _httpListener
                .HttpRequestObservable
                .Where(req => req.Method == "NOTIFY")
                .Select(req => new Notify(req));

        public IObservable<IMSearchResponse> MSearchResponseObservable => 
            _httpListener
            .HttpResponseObservable
            .Where(x => !x.IsUnableToParseHttp && !x.IsRequestTimedOut)
            .Select(response => new MSearchResponse(response));

        public ControlPoint(IHttpListener httpListener)
        {
            _httpListener = httpListener;
        }

        public async Task SendMSearch(IMSearch mSearch)<commit_msg>Making NotifyObservable more robust<commit_after>﻿using System;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using ISDPP.UPnP.PCL.Interfaces.Model;
using ISDPP.UPnP.PCL.Interfaces.Service;
using ISimpleHttpServer.Service;
using SDPP.UPnP.PCL.Model;

namespace SDPP.UPnP.PCL.Service
{
    public class ControlPoint : IControlPoint
    {
        private readonly IHttpListener _httpListener;

        public IObservable<INotify> NotifyObservable =>
            _httpListener
                .HttpRequestObservable
                .Where(x => !x.IsUnableToParseHttp && !x.IsRequestTimedOut)
                .Where(req => req.Method == "NOTIFY")
                .Select(req => new Notify(req));

        public IObservable<IMSearchResponse> MSearchResponseObservable => 
            _httpListener
            .HttpResponseObservable
            .Where(x => !x.IsUnableToParseHttp && !x.IsRequestTimedOut)
            .Select(response => new MSearchResponse(response));

        public ControlPoint(IHttpListener httpListener)
        {
            _httpListener = httpListener;
        }

        public async Task SendMSearch(IMSearch mSearch)
{'fraction_non_alphanumeric': 0.08593054318788958, 'fraction_numerical': 0.0, 'mean_word_length': 2.695723684210526, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4870486', 'n_tokens_mistral': 654, 'n_tokens_neox': 632, 'n_words': 121}