mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
extract simple socket to lib
This commit is contained in:
parent
5e4b7d3ae9
commit
f8335e2c1f
5 changed files with 77 additions and 18 deletions
2
trunk/configure
vendored
2
trunk/configure
vendored
|
@ -189,7 +189,7 @@ APP_OBJS="${MODULE_OBJS[@]}"
|
||||||
MODULE_ID="LIBS"
|
MODULE_ID="LIBS"
|
||||||
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
|
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
|
||||||
ModuleLibIncs=(${SRS_OBJS})
|
ModuleLibIncs=(${SRS_OBJS})
|
||||||
MODULE_FILES=("srs_librtmp")
|
MODULE_FILES=("srs_librtmp" "srs_lib_simple_socket")
|
||||||
MODULE_DIR="src/libs" . auto/modules.sh
|
MODULE_DIR="src/libs" . auto/modules.sh
|
||||||
LIBS_OBJS="${MODULE_OBJS[@]}"
|
LIBS_OBJS="${MODULE_OBJS[@]}"
|
||||||
#
|
#
|
||||||
|
|
31
trunk/src/libs/srs_lib_simple_socket.cpp
Normal file
31
trunk/src/libs/srs_lib_simple_socket.cpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 winlin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <srs_lib_simple_socket.hpp>
|
||||||
|
|
||||||
|
SimpleSocketStream::SimpleSocketStream(int fd) {
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleSocketStream::~SimpleSocketStream() {
|
||||||
|
}
|
||||||
|
|
42
trunk/src/libs/srs_lib_simple_socket.hpp
Normal file
42
trunk/src/libs/srs_lib_simple_socket.hpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014 winlin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRS_LIB_SIMPLE_SOCKET_HPP
|
||||||
|
#define SRS_LIB_SIMPLE_SOCKET_HPP
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <srs_lib_simple_socket.hpp>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the stream over epoll: never wait for data coming, that is async mode.
|
||||||
|
*/
|
||||||
|
class SimpleSocketStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SimpleSocketStream(int fd);
|
||||||
|
virtual ~SimpleSocketStream();
|
||||||
|
public:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -30,23 +30,7 @@ using namespace std;
|
||||||
|
|
||||||
#include <srs_kernel_error.hpp>
|
#include <srs_kernel_error.hpp>
|
||||||
#include <srs_protocol_rtmp.hpp>
|
#include <srs_protocol_rtmp.hpp>
|
||||||
|
#include <srs_lib_simple_socket.hpp>
|
||||||
/**
|
|
||||||
* the stream over epoll: never wait for data coming, that is async mode.
|
|
||||||
*/
|
|
||||||
class SimpleSocketStream
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
int sock;
|
|
||||||
public:
|
|
||||||
SimpleSocketStream(int fd){
|
|
||||||
sock = fd;
|
|
||||||
}
|
|
||||||
virtual ~SimpleSocketStream() {
|
|
||||||
::close(sock);
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* export runtime context.
|
* export runtime context.
|
||||||
|
|
|
@ -7,6 +7,8 @@ file
|
||||||
libs readonly separator,
|
libs readonly separator,
|
||||||
..\libs\srs_librtmp.hpp,
|
..\libs\srs_librtmp.hpp,
|
||||||
..\libs\srs_librtmp.cpp,
|
..\libs\srs_librtmp.cpp,
|
||||||
|
..\libs\srs_lib_simple_socket.hpp,
|
||||||
|
..\libs\srs_lib_simple_socket.cpp,
|
||||||
core readonly separator,
|
core readonly separator,
|
||||||
..\core\srs_core.hpp,
|
..\core\srs_core.hpp,
|
||||||
..\core\srs_core.cpp,
|
..\core\srs_core.cpp,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue