正在显示
1 个修改的文件
包含
14 行增加
和
14 行删除
@@ -130,18 +130,18 @@ int SrsListener::listen(int port) | @@ -130,18 +130,18 @@ int SrsListener::listen(int port) | ||
130 | 130 | ||
131 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { | 131 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { |
132 | ret = ERROR_SOCKET_CREATE; | 132 | ret = ERROR_SOCKET_CREATE; |
133 | - srs_error("create linux socket error. ret=%d", ret); | 133 | + srs_error("create linux socket error. port=%d, ret=%d", port, ret); |
134 | return ret; | 134 | return ret; |
135 | } | 135 | } |
136 | - srs_verbose("create linux socket success. fd=%d", fd); | 136 | + srs_verbose("create linux socket success. port=%d, fd=%d", port, fd); |
137 | 137 | ||
138 | int reuse_socket = 1; | 138 | int reuse_socket = 1; |
139 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse_socket, sizeof(int)) == -1) { | 139 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse_socket, sizeof(int)) == -1) { |
140 | ret = ERROR_SOCKET_SETREUSE; | 140 | ret = ERROR_SOCKET_SETREUSE; |
141 | - srs_error("setsockopt reuse-addr error. ret=%d", ret); | 141 | + srs_error("setsockopt reuse-addr error. port=%d, ret=%d", port, ret); |
142 | return ret; | 142 | return ret; |
143 | } | 143 | } |
144 | - srs_verbose("setsockopt reuse-addr success. fd=%d", fd); | 144 | + srs_verbose("setsockopt reuse-addr success. port=%d, fd=%d", port, fd); |
145 | 145 | ||
146 | sockaddr_in addr; | 146 | sockaddr_in addr; |
147 | addr.sin_family = AF_INET; | 147 | addr.sin_family = AF_INET; |
@@ -149,34 +149,34 @@ int SrsListener::listen(int port) | @@ -149,34 +149,34 @@ int SrsListener::listen(int port) | ||
149 | addr.sin_addr.s_addr = INADDR_ANY; | 149 | addr.sin_addr.s_addr = INADDR_ANY; |
150 | if (bind(fd, (const sockaddr*)&addr, sizeof(sockaddr_in)) == -1) { | 150 | if (bind(fd, (const sockaddr*)&addr, sizeof(sockaddr_in)) == -1) { |
151 | ret = ERROR_SOCKET_BIND; | 151 | ret = ERROR_SOCKET_BIND; |
152 | - srs_error("bind socket error. ret=%d", ret); | 152 | + srs_error("bind socket error. port=%d, ret=%d", port, ret); |
153 | return ret; | 153 | return ret; |
154 | } | 154 | } |
155 | - srs_verbose("bind socket success. fd=%d", fd); | 155 | + srs_verbose("bind socket success. port=%d, fd=%d", port, fd); |
156 | 156 | ||
157 | if (::listen(fd, SERVER_LISTEN_BACKLOG) == -1) { | 157 | if (::listen(fd, SERVER_LISTEN_BACKLOG) == -1) { |
158 | ret = ERROR_SOCKET_LISTEN; | 158 | ret = ERROR_SOCKET_LISTEN; |
159 | - srs_error("listen socket error. ret=%d", ret); | 159 | + srs_error("listen socket error. port=%d, ret=%d", port, ret); |
160 | return ret; | 160 | return ret; |
161 | } | 161 | } |
162 | - srs_verbose("listen socket success. fd=%d", fd); | 162 | + srs_verbose("listen socket success. port=%d, fd=%d", port, fd); |
163 | 163 | ||
164 | if ((stfd = st_netfd_open_socket(fd)) == NULL){ | 164 | if ((stfd = st_netfd_open_socket(fd)) == NULL){ |
165 | ret = ERROR_ST_OPEN_SOCKET; | 165 | ret = ERROR_ST_OPEN_SOCKET; |
166 | - srs_error("st_netfd_open_socket open socket failed. ret=%d", ret); | 166 | + srs_error("st_netfd_open_socket open socket failed. port=%d, ret=%d", port, ret); |
167 | return ret; | 167 | return ret; |
168 | } | 168 | } |
169 | - srs_verbose("st open socket success. fd=%d", fd); | 169 | + srs_verbose("st open socket success. port=%d, fd=%d", port, fd); |
170 | 170 | ||
171 | if ((ret = pthread->start()) != ERROR_SUCCESS) { | 171 | if ((ret = pthread->start()) != ERROR_SUCCESS) { |
172 | - srs_error("st_thread_create listen thread error. ret=%d", ret); | 172 | + srs_error("st_thread_create listen thread error. port=%d, ret=%d", port, ret); |
173 | return ret; | 173 | return ret; |
174 | } | 174 | } |
175 | - srs_verbose("create st listen thread success."); | 175 | + srs_verbose("create st listen thread success, port=%d", port); |
176 | 176 | ||
177 | srs_trace("listen thread cid=%d, current_cid=%d, " | 177 | srs_trace("listen thread cid=%d, current_cid=%d, " |
178 | - "listen at port=%d, type=%d, fd=%d started success", | ||
179 | - pthread->cid(), _srs_context->get_id(), _port, _type, fd); | 178 | + "listen at port=%d, type=%d, fd=%d started success, port=%d", |
179 | + pthread->cid(), _srs_context->get_id(), _port, _type, fd, port); | ||
180 | 180 | ||
181 | return ret; | 181 | return ret; |
182 | } | 182 | } |
-
请 注册 或 登录 后发表评论