OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 // of the pipe in Connect(). | 898 // of the pipe in Connect(). |
899 waiting_connect_ = false; | 899 waiting_connect_ = false; |
900 } | 900 } |
901 send_server_hello_msg = true; | 901 send_server_hello_msg = true; |
902 } | 902 } |
903 | 903 |
904 if (!waiting_connect_ && fd == pipe_) { | 904 if (!waiting_connect_ && fd == pipe_) { |
905 if (!ProcessIncomingMessages()) { | 905 if (!ProcessIncomingMessages()) { |
906 Close(); | 906 Close(); |
907 listener_->OnChannelError(); | 907 listener_->OnChannelError(); |
| 908 // The OnChannelError() call may delete this, so we need to exit now. |
| 909 return; |
908 } | 910 } |
909 } | 911 } |
910 | 912 |
911 // If we're a server and handshaking, then we want to make sure that we | 913 // If we're a server and handshaking, then we want to make sure that we |
912 // only send our handshake message after we've processed the client's. | 914 // only send our handshake message after we've processed the client's. |
913 // This gives us a chance to kill the client if the incoming handshake | 915 // This gives us a chance to kill the client if the incoming handshake |
914 // is invalid. | 916 // is invalid. |
915 if (send_server_hello_msg) { | 917 if (send_server_hello_msg) { |
916 // This should be our first write so there's no chance we can block here... | 918 // This should be our first write so there's no chance we can block here... |
917 DCHECK(is_blocked_on_write_ == false); | 919 DCHECK(is_blocked_on_write_ == false); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 | 1007 |
1006 bool Channel::Send(Message* message) { | 1008 bool Channel::Send(Message* message) { |
1007 return channel_impl_->Send(message); | 1009 return channel_impl_->Send(message); |
1008 } | 1010 } |
1009 | 1011 |
1010 int Channel::GetClientFileDescriptor() const { | 1012 int Channel::GetClientFileDescriptor() const { |
1011 return channel_impl_->GetClientFileDescriptor(); | 1013 return channel_impl_->GetClientFileDescriptor(); |
1012 } | 1014 } |
1013 | 1015 |
1014 } // namespace IPC | 1016 } // namespace IPC |
OLD | NEW |