-/* $Id: glibwww-callbacks.cc,v 1.2 2001/12/27 19:55:37 richard Exp $ -*- C++ -*-
+/* $Id: glibwww-callbacks.cc,v 1.1.1.1 2003/07/04 22:30:07 atterer Exp $ -*- C++ -*-
This code was taken from glibwww2
<http://cvs.gnome.org/lxr/source/glibwww2/>, main author: James
#define WRITE_CONDITION (G_IO_OUT | G_IO_ERR)
#define EXCEPTION_CONDITION (G_IO_PRI)
/* Windows: Need G_IO_IN for WRITE_CONDITION, otherwise connect() hangs */
-#ifdef G_OS_WIN322
+#ifdef G_OS_WIN32
# undef WRITE_CONDITION
# define WRITE_CONDITION (G_IO_IN | G_IO_OUT | G_IO_ERR)
#endif
info = g_new0(SockInfo, 1);
info->s = s;
# ifdef G_OS_WIN32
- info->io = g_io_channel_win32_new_stream_socket(s);
-# else
+ info->io = g_io_channel_win32_new_socket(s);
+# else
info->io = g_io_channel_unix_new(s);
# endif
info->ev[0].s = info->ev[1].s = info->ev[2].s = s;
static int
glibwww_event_register (SOCKET s, HTEventType type, HTEvent *event)
{
+ //fprintf(stderr, "glibwww_event_register socket=%d type=%d event=%p\n", s, int(type), event);
SockInfo *info;
gint priority = G_PRIORITY_DEFAULT;
GIOCondition condition;
glibwww_event_unregister (SOCKET s, HTEventType type)
{
SockInfo *info = get_sock_info(s, FALSE);
+ //fprintf(stderr, "glibwww_event_unregister socket=%d type=%d info=%p\n", s, int(type), info);
if (info) {
if (info->ev[HTEvent_INDEX(type)].io_tag)
info->ev[HTEvent_INDEX(type)].io_tag = 0;
info->ev[HTEvent_INDEX(type)].timer_tag = 0;
- /* clean up sock hash if needed */
- /* if (info->ev[0].io_tag == 0 &&
- info->ev[1].io_tag == 0 &&
- info->ev[2].io_tag == 0) {
- g_message("Freeing sock:%d", s);
- g_hash_table_remove(sockhash, GINT_TO_POINTER(s));
- g_io_channel_unref(info->io);
- g_free(info);
- } */
+# ifdef G_OS_WIN32
+ /* clean up sock hash if needed */
+ if (info->ev[0].io_tag == 0 && info->ev[1].io_tag == 0
+ && info->ev[2].io_tag == 0) {
+ /*g_message("Freeing sock:%d", s);*/
+ g_hash_table_remove(sockhash, GINT_TO_POINTER(s));
+ g_io_channel_unref(info->io);
+ g_free(info);
+ }
+# endif
return HT_OK;
}
{
SockEventInfo *info = (SockEventInfo *)data;
HTEvent *event = info->event;
+ //fprintf(stderr, "glibwww_io_func: event %p, event->cbf %p\n", event, event->cbf);
if (info->timer_tag) {
g_source_remove(info->timer_tag);