// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java
// public class LogUtils {
// 
// 
//     public static Context context;
// 
//     private static void sendLogData(String tag,String msg){
// 
//     }
// 
//     public static void v(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.v(tag,msg);
//     }
// 
//     public static void v(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.v(tag,msg,tr);
//     }
// 
//     public static void d(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.d(tag,msg);
//     }
// 
//     public static void d(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.d(tag,msg,tr);
//     }
// 
//     public static void i(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.i(tag,msg);
//     }
// 
//     public static void i(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.i(tag,msg,tr);
//     }
// 
//     public static void w(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.w(tag,msg);
//     }
// 
//     public static void w(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.w(tag,msg,tr);
//     }
// 
//     public static void e(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.e(tag,msg);
//     }
// 
//     public static void e(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.e(tag,msg,tr);
//     }
// 
// }


import com.github.xfalcon.vhosts.util.LogUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.locks.ReentrantLock;
/*
** Copyright 2015, Mohamed Naufal
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/

package com.github.xfalcon.vhosts.vservice;




public class TCPInput implements Runnable
{
    private static final String TAG = TCPInput.class.getSimpleName();

    private ConcurrentLinkedQueue<ByteBuffer> outputQueue;
    private Selector selector;
    private ReentrantLock tcpSelectorLock;

    public TCPInput(ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector,ReentrantLock tcpSelectorLock)
    {
        this.outputQueue = outputQueue;
        this.selector = selector;
        this.tcpSelectorLock=tcpSelectorLock;
    }

    @Override
    public void run()
    {
        try
        {
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java
// public class LogUtils {
// 
// 
//     public static Context context;
// 
//     private static void sendLogData(String tag,String msg){
// 
//     }
// 
//     public static void v(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.v(tag,msg);
//     }
// 
//     public static void v(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.v(tag,msg,tr);
//     }
// 
//     public static void d(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.d(tag,msg);
//     }
// 
//     public static void d(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.d(tag,msg,tr);
//     }
// 
//     public static void i(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.i(tag,msg);
//     }
// 
//     public static void i(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.i(tag,msg,tr);
//     }
// 
//     public static void w(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.w(tag,msg);
//     }
// 
//     public static void w(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.w(tag,msg,tr);
//     }
// 
//     public static void e(String tag, String msg) {
//         sendLogData(tag,msg);
//         Log.e(tag,msg);
//     }
// 
//     public static void e(String tag, String msg, Throwable tr) {
//         sendLogData(tag,msg+"   ;"+tr.getMessage());
//         Log.e(tag,msg,tr);
//     }
// 
// }


// Path: app/src/main/java/com/github/xfalcon/vhosts/vservice/TCPInput.java
import com.github.xfalcon.vhosts.util.LogUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.locks.ReentrantLock;

/*
** Copyright 2015, Mohamed Naufal
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/

package com.github.xfalcon.vhosts.vservice;




public class TCPInput implements Runnable
{
    private static final String TAG = TCPInput.class.getSimpleName();

    private ConcurrentLinkedQueue<ByteBuffer> outputQueue;
    private Selector selector;
    private ReentrantLock tcpSelectorLock;

    public TCPInput(ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector,ReentrantLock tcpSelectorLock)
    {
        this.outputQueue = outputQueue;
        this.selector = selector;
        this.tcpSelectorLock=tcpSelectorLock;
    }

    @Override
    public void run()
    {
        try
        {
            LogUtils.i(TAG, "Started");