Unverified Commit cc49eff7 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #469 from ipconfigme/master

add GetSockOption to controller; fix some typo
parents fc0fefb5 b332e0b7
...@@ -1382,6 +1382,16 @@ x509_st* Controller::get_peer_certificate() const { ...@@ -1382,6 +1382,16 @@ x509_st* Controller::get_peer_certificate() const {
return s ? s->GetPeerCertificate() : NULL; return s ? s->GetPeerCertificate() : NULL;
} }
int Controller::GetSockOption(int level, int optname, void* optval, socklen_t* optlen) {
Socket* s = _current_call.sending_sock.get();
if (s) {
return getsockopt(s->fd(), level, optname, optval, optlen);
} else {
errno = EBADF;
return -1;
}
}
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
typedef sig_t SignalHandler; typedef sig_t SignalHandler;
#else #else
......
...@@ -591,6 +591,9 @@ private: ...@@ -591,6 +591,9 @@ private:
void set_used_by_rpc() { add_flag(FLAGS_USED_BY_RPC); } void set_used_by_rpc() { add_flag(FLAGS_USED_BY_RPC); }
bool is_used_by_rpc() const { return has_flag(FLAGS_USED_BY_RPC); } bool is_used_by_rpc() const { return has_flag(FLAGS_USED_BY_RPC); }
// Get sock option. .e.g get vip info through ttm kernel module hook,
int GetSockOption(int level, int optname, void* optval, socklen_t* optlen);
private: private:
// NOTE: align and group fields to make Controller as compact as possible. // NOTE: align and group fields to make Controller as compact as possible.
......
...@@ -560,7 +560,7 @@ void SerializeRtmpRequest(butil::IOBuf* buf, ...@@ -560,7 +560,7 @@ void SerializeRtmpRequest(butil::IOBuf* buf,
Controller* cntl, Controller* cntl,
const google::protobuf::Message* request); const google::protobuf::Message* request);
// ============== inlien impl. ================= // ============== inline impl. =================
// TODO(gejun): impl. do not work for big-endian machines. // TODO(gejun): impl. do not work for big-endian machines.
inline uint8_t Read1Byte(const void* void_buf) { inline uint8_t Read1Byte(const void* void_buf) {
return *(const char*)void_buf; return *(const char*)void_buf;
......
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