winlin

refine code.

@@ -21,4 +21,9 @@ CONTRIBUTORS ordered by first contribution. @@ -21,4 +21,9 @@ CONTRIBUTORS ordered by first contribution.
21 * allspace<allspace@gmail.com> "The srs-librtmp windows support" 21 * allspace<allspace@gmail.com> "The srs-librtmp windows support"
22 * niesongsong<nie950@gmail.com> "Configure support relative path" 22 * niesongsong<nie950@gmail.com> "Configure support relative path"
23 * rudeb0t<nimrod@themanxgroup.tw> "Bug fixed" 23 * rudeb0t<nimrod@themanxgroup.tw> "Bug fixed"
  24 +* CallMeNP<np.liamg@gmail.com> "Bug fixed"
  25 +* synote<synote@qq.com> "Bug fixed"
  26 +* lovecat<littlefawn@163.com> "Bug fixed"
  27 +* panda1986<542638787@qq.com> "Bug fixed"
  28 +* YueHonghui<hongf.yue@hotmail.com> "Bug fixed"
24 29
@@ -1488,7 +1488,7 @@ int SrsConfig::parse_argv(int& i, char** argv) @@ -1488,7 +1488,7 @@ int SrsConfig::parse_argv(int& i, char** argv)
1488 void SrsConfig::print_help(char** argv) 1488 void SrsConfig::print_help(char** argv)
1489 { 1489 {
1490 printf( 1490 printf(
1491 - RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION" "RTMP_SIG_SRS_COPYRIGHT"\n" 1491 + RTMP_SIG_SRS_SERVER" "RTMP_SIG_SRS_COPYRIGHT"\n"
1492 "License: "RTMP_SIG_SRS_LICENSE"\n" 1492 "License: "RTMP_SIG_SRS_LICENSE"\n"
1493 "Primary: "RTMP_SIG_SRS_PRIMARY"\n" 1493 "Primary: "RTMP_SIG_SRS_PRIMARY"\n"
1494 "Authors: "RTMP_SIG_SRS_AUTHROS"\n" 1494 "Authors: "RTMP_SIG_SRS_AUTHROS"\n"
@@ -279,7 +279,7 @@ int SrsHttpResponseWriter::send_header(char* data, int size) @@ -279,7 +279,7 @@ int SrsHttpResponseWriter::send_header(char* data, int size)
279 279
280 // set server if not set. 280 // set server if not set.
281 if (hdr->get("Server").empty()) { 281 if (hdr->get("Server").empty()) {
282 - hdr->set("Server", RTMP_SIG_SRS_KEY"/"RTMP_SIG_SRS_VERSION); 282 + hdr->set("Server", RTMP_SIG_SRS_SERVER);
283 } 283 }
284 284
285 // chunked encoding 285 // chunked encoding
@@ -33,22 +33,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -33,22 +33,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 #define VERSION_REVISION 206 34 #define VERSION_REVISION 206
35 35
36 -// server info. 36 +// generated by configure, only macros.
  37 +#include <srs_auto_headers.hpp>
  38 +
  39 +// provider info.
37 #define RTMP_SIG_SRS_KEY "SRS" 40 #define RTMP_SIG_SRS_KEY "SRS"
38 #define RTMP_SIG_SRS_CODE "ZhouGuowen" 41 #define RTMP_SIG_SRS_CODE "ZhouGuowen"
39 -#define RTMP_SIG_SRS_ROLE "origin/edge server" 42 +#define RTMP_SIG_SRS_AUTHROS "winlin,wenjie.zhao"
  43 +// contact info.
  44 +#define RTMP_SIG_SRS_WEB "http://ossrs.net"
  45 +#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com"
  46 +// debug info.
  47 +#define RTMP_SIG_SRS_ROLE "cluster"
40 #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)" 48 #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)"
41 #define RTMP_SIG_SRS_URL_SHORT "github.com/ossrs/srs" 49 #define RTMP_SIG_SRS_URL_SHORT "github.com/ossrs/srs"
42 #define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT 50 #define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT
43 -#define RTMP_SIG_SRS_WEB "http://ossrs.net"  
44 -#define RTMP_SIG_SRS_EMAIL "winlin@vip.126.com"  
45 #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" 51 #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
46 #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2015 SRS(ossrs)" 52 #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2015 SRS(ossrs)"
47 -#define RTMP_SIG_SRS_PRIMARY "SRS/"VERSION_STABLE_BRANCH  
48 -#define RTMP_SIG_SRS_AUTHROS "winlin,wenjie.zhao" 53 +#define RTMP_SIG_SRS_PRIMARY RTMP_SIG_SRS_KEY"/"VERSION_STABLE_BRANCH
49 #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt" 54 #define RTMP_SIG_SRS_CONTRIBUTORS_URL RTMP_SIG_SRS_URL"/blob/master/AUTHORS.txt"
50 #define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")" 55 #define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY"("RTMP_SIG_SRS_VERSION")"
51 -#define RTMP_SIG_SRS_RELEASE RTMP_SIG_SRS_URL"/tree/1.0release" 56 +#define RTMP_SIG_SRS_RELEASE RTMP_SIG_SRS_URL"/tree/"VERSION_STABLE_BRANCH".0release"
52 #define RTMP_SIG_SRS_ISSUES(id) RTMP_SIG_SRS_URL"/issues/"#id 57 #define RTMP_SIG_SRS_ISSUES(id) RTMP_SIG_SRS_URL"/issues/"#id
53 #define RTMP_SIG_SRS_VERSION SRS_XSTR(VERSION_MAJOR)"."SRS_XSTR(VERSION_MINOR)"."SRS_XSTR(VERSION_REVISION) 58 #define RTMP_SIG_SRS_VERSION SRS_XSTR(VERSION_MAJOR)"."SRS_XSTR(VERSION_MINOR)"."SRS_XSTR(VERSION_REVISION)
54 #define RTMP_SIG_SRS_SERVER RTMP_SIG_SRS_KEY"/"RTMP_SIG_SRS_VERSION"("RTMP_SIG_SRS_CODE")" 59 #define RTMP_SIG_SRS_SERVER RTMP_SIG_SRS_KEY"/"RTMP_SIG_SRS_VERSION"("RTMP_SIG_SRS_CODE")"
@@ -90,8 +95,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -90,8 +95,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90 #include <stddef.h> 95 #include <stddef.h>
91 #include <sys/types.h> 96 #include <sys/types.h>
92 97
93 -// generated by configure.  
94 -#include <srs_auto_headers.hpp>  
95 // important performance options. 98 // important performance options.
96 #include <srs_core_performance.hpp> 99 #include <srs_core_performance.hpp>
97 100
@@ -289,6 +289,16 @@ bool srs_string_contains(string str, string flag) @@ -289,6 +289,16 @@ bool srs_string_contains(string str, string flag)
289 return str.find(flag) != string::npos; 289 return str.find(flag) != string::npos;
290 } 290 }
291 291
  292 +bool srs_string_contains(string str, string flag0, string flag1)
  293 +{
  294 + return str.find(flag0) != string::npos || str.find(flag1) != string::npos;
  295 +}
  296 +
  297 +bool srs_string_contains(string str, string flag0, string flag1, string flag2)
  298 +{
  299 + return str.find(flag0) != string::npos || str.find(flag1) != string::npos || str.find(flag2) != string::npos;
  300 +}
  301 +
292 int srs_do_create_dir_recursively(string dir) 302 int srs_do_create_dir_recursively(string dir)
293 { 303 {
294 int ret = ERROR_SUCCESS; 304 int ret = ERROR_SUCCESS;
@@ -70,6 +70,8 @@ extern bool srs_string_starts_with(std::string str, std::string flag); @@ -70,6 +70,8 @@ extern bool srs_string_starts_with(std::string str, std::string flag);
70 extern bool srs_string_starts_with(std::string str, std::string flag0, std::string flag1); 70 extern bool srs_string_starts_with(std::string str, std::string flag0, std::string flag1);
71 // whether string contains with 71 // whether string contains with
72 extern bool srs_string_contains(std::string str, std::string flag); 72 extern bool srs_string_contains(std::string str, std::string flag);
  73 +extern bool srs_string_contains(std::string str, std::string flag0, std::string flag1);
  74 +extern bool srs_string_contains(std::string str, std::string flag0, std::string flag1, std::string flag2);
73 75
74 // create dir recursively 76 // create dir recursively
75 extern int srs_create_dir_recursively(std::string dir); 77 extern int srs_create_dir_recursively(std::string dir);
@@ -248,6 +248,9 @@ void check_macro_features() @@ -248,6 +248,9 @@ void check_macro_features()
248 int main(int argc, char** argv) 248 int main(int argc, char** argv)
249 { 249 {
250 int ret = ERROR_SUCCESS; 250 int ret = ERROR_SUCCESS;
  251 +
  252 + // first hello message.
  253 + srs_trace(RTMP_SIG_SRS_SERVER);
251 254
252 // TODO: support both little and big endian. 255 // TODO: support both little and big endian.
253 srs_assert(srs_is_little_endian()); 256 srs_assert(srs_is_little_endian());
@@ -290,7 +293,7 @@ int main(int argc, char** argv) @@ -290,7 +293,7 @@ int main(int argc, char** argv)
290 return ret; 293 return ret;
291 } 294 }
292 295
293 - srs_trace("srs(ossrs) "RTMP_SIG_SRS_VERSION); 296 + srs_trace(RTMP_SIG_SRS_SERVER", stable is "RTMP_SIG_SRS_PRIMARY);
294 srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT); 297 srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT);
295 srs_trace("primary/master: "RTMP_SIG_SRS_PRIMARY); 298 srs_trace("primary/master: "RTMP_SIG_SRS_PRIMARY);
296 srs_trace("authors: "RTMP_SIG_SRS_AUTHROS); 299 srs_trace("authors: "RTMP_SIG_SRS_AUTHROS);