Unverified Commit 1b865a89 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #307 from brpc/jiangrujie-dev

Add docs & Fix SSL UT
parents b4d0fc35 381b734c
......@@ -75,6 +75,7 @@ You can use it to:
* [FlatMap](docs/cn/flatmap.md)
* [brpc外功修炼宝典](docs/cn/brpc_intro.pptx)(training material)
* [A tutorial on building large-scale services](docs/en/tutorial_on_building_services.pptx)(training material)
* [brpc internal](docs/en/brpc_internal.pptx)(training material)
* RPC in depth
* [New Protocol](docs/en/new_protocol.md)
* [Atomic instructions](docs/en/atomic_instructions.md)
......
......@@ -76,6 +76,7 @@
* [FlatMap](docs/cn/flatmap.md)
* [brpc外功修炼宝典](docs/cn/brpc_intro.pptx)(培训材料)
* [搭建大型服务入门](docs/en/tutorial_on_building_services.pptx)(培训材料)
* [brpc内功修炼宝典](docs/en/brpc_internal.pptx)(培训材料)
* 深入RPC
* [New Protocol](docs/cn/new_protocol.md)
* [Atomic instructions](docs/cn/atomic_instructions.md)
......
File mode changed from 100755 to 100644
No preview for this file type
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -648,6 +648,7 @@ int Socket::Create(const SocketOptions& options, SocketId* id) {
}
m->_last_writetime_us.store(cpuwide_now, butil::memory_order_relaxed);
m->_unwritten_bytes.store(0, butil::memory_order_relaxed);
m->_options = options;
CHECK(NULL == m->_write_head.load(butil::memory_order_relaxed));
// Must be last one! Internal fields of this Socket may be access
// just after calling ResetFileDescriptor.
......@@ -659,7 +660,6 @@ int Socket::Create(const SocketOptions& options, SocketId* id) {
return -1;
}
*id = m->_this_id;
m->_options = options;
return 0;
}
......@@ -1730,7 +1730,7 @@ ssize_t Socket::DoWrite(WriteRequest* req) {
}
}
CHECK(ssl_state() == SSL_CONNECTED);
CHECK_EQ(SSL_CONNECTED, ssl_state());
if (_conn) {
// TODO: Separate SSL stuff from SocketConnection
return _conn->CutMessageIntoSSLChannel(_ssl_session, data_list, ndata);
......@@ -1769,6 +1769,10 @@ ssize_t Socket::DoWrite(WriteRequest* req) {
int Socket::SSLHandshake(int fd, bool server_mode) {
if (_options.ssl_ctx == NULL) {
if (server_mode) {
LOG(ERROR) << "Lack SSL configuration to handle SSL request";
return -1;
}
return 0;
}
......@@ -1866,7 +1870,7 @@ ssize_t Socket::DoRead(size_t size_hint) {
return _read_buf.append_from_file_descriptor(fd(), size_hint);
}
CHECK(ssl_state() == SSL_CONNECTED);
CHECK_EQ(SSL_CONNECTED, ssl_state());
int ssl_error = 0;
ssize_t nr = _read_buf.append_from_SSL_channel(_ssl_session, &ssl_error, size_hint);
switch (ssl_error) {
......
......@@ -331,4 +331,6 @@ TEST_F(SSLTest, ssl_perf) {
ASSERT_EQ(0, pthread_create(&spid, NULL, ssl_perf_server , serv_ssl));
ASSERT_EQ(0, pthread_join(cpid, NULL));
ASSERT_EQ(0, pthread_join(spid, NULL));
close(clifd);
close(servfd);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment