#define PROCESS_EVENTS()
#endif // wxUSE_GUI/!wxUSE_GUI
+#define wxTRACE_Socket _T("wxSocket")
+
// --------------------------------------------------------------------------
// wxWin macros
// --------------------------------------------------------------------------
public:
wxSocketState() : wxObject() {}
+
+ DECLARE_NO_COPY_CLASS(wxSocketState)
};
// ==========================================================================
return FALSE;
peer = GSocket_GetPeer(m_socket);
+
+ // copying a null address would just trigger an assert anyway
+
+ if (!peer)
+ return FALSE;
+
addr_man.SetAddress(peer);
GAddress_destroy(peer);
wxNode *node;
wxSocketState *state;
- node = m_states.Last();
+ node = m_states.GetLast();
if (!node)
return;
- state = (wxSocketState *)node->Data();
+ state = (wxSocketState *)node->GetData();
m_flags = state->m_flags;
m_notify = state->m_notify;
wxSocketFlags flags)
: wxSocketBase(flags, wxSOCKET_SERVER)
{
- // Create the socket
- m_socket = GSocket_new();
+ wxLogTrace( wxTRACE_Socket, _T("Opening wxSocketServer") );
- if (!m_socket)
- return;
+ m_socket = GSocket_new();
- // Setup the socket as server
- GSocket_SetLocal(m_socket, addr_man.GetAddress());
- if (GSocket_SetServer(m_socket) != GSOCK_NOERROR)
- {
- GSocket_destroy(m_socket);
- m_socket = NULL;
- return;
- }
+ if (!m_socket)
+ {
+ wxLogTrace( wxTRACE_Socket, _T("*** GSocket_new failed") );
+ return;
+ }
- GSocket_SetTimeout(m_socket, m_timeout * 1000);
- GSocket_SetCallback(m_socket, GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
- GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
- wx_socket_callback, (char *)this);
+ // Setup the socket as server
+ GSocket_SetLocal(m_socket, addr_man.GetAddress());
+ if (GSocket_SetServer(m_socket) != GSOCK_NOERROR)
+ {
+ GSocket_destroy(m_socket);
+ m_socket = NULL;
+
+ wxLogTrace( wxTRACE_Socket, _T("*** GSocket_SetServer failed") );
+ return;
+ }
+
+ GSocket_SetTimeout(m_socket, m_timeout * 1000);
+ GSocket_SetCallback(m_socket, GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
+ GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
+ wx_socket_callback, (char *)this);
}
// --------------------------------------------------------------------------
#endif
// wxUSE_SOCKETS
+
+// vi:sts=4:sw=4:et