fix bug: d->sock un-initialized