<commit_before>use std::net::{TcpListener, TcpStream};

extern crate rust_ofp;
use rust_ofp::ofp_controller::OfpController;
use rust_ofp::ofp_controller::openflow0x01::OF0x01Controller;
use rust_ofp::openflow0x01::{SwitchFeatures, PacketIn, Pattern};
use rust_ofp::openflow0x01::message::{add_flow, Message};

fn main() {
    struct OF0x01;
    impl OF0x01Controller for OF0x01 {
        fn switch_connected(_: u64, _: SwitchFeatures, stream: &mut TcpStream) {
            let prio = 0;
            let pat = Pattern::match_all();
            let message = Message::FlowMod(add_flow(prio, pat, vec![]));
            Self::send_message(1000, message, stream)
        }

        fn switch_disconnected(_: u64) {
        }

        fn packet_in(_: u64, _: u32, _: PacketIn, _: &mut TcpStream) {
        }
    }

    let listener = TcpListener::bind(("127.0.0.1", 6633)).unwrap();
    for stream in listener.incoming() {
        match stream {
            Ok(mut stream) => {
                std::thread::spawn(move || OF0x01::handle_client_connected(&mut stream));
            }
            Err(_) => {
                // connection failed
                panic!("Connection failed")
            }
        }
    }
}<commit_msg>Fix trait impl for exe controller<commit_after>use std::net::{TcpListener, TcpStream};

extern crate rust_ofp;
use rust_ofp::ofp_controller::OfpController;
use rust_ofp::ofp_controller::openflow0x01::OF0x01Controller;
use rust_ofp::openflow0x01::{SwitchFeatures, PacketIn, Pattern};
use rust_ofp::openflow0x01::message::{add_flow, Message};

fn main() {
    struct OF0x01;
    impl OF0x01Controller for OF0x01 {
        fn new() -> OF0x01 {
            OF0x01 {}
        }

        fn switch_connected(&mut self, _: u64, _: SwitchFeatures, stream: &mut TcpStream) {
            let prio = 0;
            let pat = Pattern::match_all();
            let message = Message::FlowMod(add_flow(prio, pat, vec![]));
            Self::send_message(1000, message, stream)
        }

        fn switch_disconnected(&mut self, _: u64) {}

        fn packet_in(&mut self, _: u64, _: u32, _: PacketIn, _: &mut TcpStream) {}
    }

    let listener = TcpListener::bind(("127.0.0.1", 6633)).unwrap();
    for stream in listener.incoming() {
        match stream {
            Ok(mut stream) => {
                std::thread::spawn(move || OF0x01::handle_client_connected(&mut stream));
            }
            Err(_) => {
                // connection failed
                panic!("Connection failed")
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.13202357563850686, 'fraction_numerical': 0.03929273084479371, 'mean_word_length': 2.4876712328767123, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5722255', 'n_tokens_mistral': 865, 'n_tokens_neox': 808, 'n_words': 164}